fix fetching secrets via service token

This commit is contained in:
Maidul Islam
2023-06-27 15:00:03 -04:00
parent f9d0e0d971
commit 798f091ff2
3 changed files with 3 additions and 2 deletions
@@ -53,7 +53,7 @@ export const getServiceTokenData = async (req: Request, res: Response) => {
req.authData.authPayload._id req.authData.authPayload._id
) )
.select("+encryptedKey +iv +tag") .select("+encryptedKey +iv +tag")
.populate("user"); .populate("user").lean();
return res.status(200).json(serviceTokenData); return res.status(200).json(serviceTokenData);
}; };
+1 -1
View File
@@ -188,7 +188,7 @@ type GetServiceTokenDetailsResponse struct {
Tag string `json:"tag"` Tag string `json:"tag"`
CreatedAt time.Time `json:"createdAt"` CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"` UpdatedAt time.Time `json:"updatedAt"`
V int `json:"__v"` SecretPath string `json:"secretPath"`
} }
type GetAccessibleEnvironmentsRequest struct { type GetAccessibleEnvironmentsRequest struct {
+1
View File
@@ -37,6 +37,7 @@ func GetPlainTextSecretsViaServiceToken(fullServiceToken string) ([]models.Singl
encryptedSecrets, err := api.CallGetSecretsV3(httpClient, api.GetEncryptedSecretsV3Request{ encryptedSecrets, err := api.CallGetSecretsV3(httpClient, api.GetEncryptedSecretsV3Request{
WorkspaceId: serviceTokenDetails.Workspace, WorkspaceId: serviceTokenDetails.Workspace,
Environment: serviceTokenDetails.Environment, Environment: serviceTokenDetails.Environment,
SecretPath: serviceTokenDetails.SecretPath,
}) })
if err != nil { if err != nil {