mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
patch get secret by name
This commit is contained in:
@@ -537,18 +537,27 @@ export const secretServiceFactory = ({
|
|||||||
|
|
||||||
const secretBlindIndex = await interalGenSecBlindIndexByName(projectId, secretName);
|
const secretBlindIndex = await interalGenSecBlindIndexByName(projectId, secretName);
|
||||||
|
|
||||||
const secret = await (typeof version !== undefined
|
// Case: The old python SDK uses incorrect logic https://github.com/Infisical/infisical-python/blob/main/infisical/client/infisicalclient.py#L89.
|
||||||
|
// Fetch secrets using service tokens cannot fetch personal secrets, only shared.
|
||||||
|
// The mongo backend used to correct this mistake, this line also adds it to current backend
|
||||||
|
// Mongo backend check: https://github.com/Infisical/infisical-mongo/blob/main/backend/src/helpers/secrets.ts#L658
|
||||||
|
let secretType = type;
|
||||||
|
if (actor === ActorType.SERVICE) {
|
||||||
|
secretType = SecretType.Shared;
|
||||||
|
}
|
||||||
|
|
||||||
|
const secret = await (typeof version === undefined
|
||||||
? secretDAL.findOne({
|
? secretDAL.findOne({
|
||||||
folderId,
|
folderId,
|
||||||
type,
|
type: secretType,
|
||||||
userId: type === SecretType.Personal ? actorId : null,
|
userId: secretType === SecretType.Personal ? actorId : null,
|
||||||
secretBlindIndex
|
secretBlindIndex
|
||||||
})
|
})
|
||||||
: secretVersionDAL
|
: secretVersionDAL
|
||||||
.findOne({
|
.findOne({
|
||||||
folderId,
|
folderId,
|
||||||
type,
|
type: secretType,
|
||||||
userId: type === SecretType.Personal ? actorId : null,
|
userId: secretType === SecretType.Personal ? actorId : null,
|
||||||
secretBlindIndex
|
secretBlindIndex
|
||||||
})
|
})
|
||||||
.then((el) => SecretsSchema.parse({ ...el, id: el.secretId })));
|
.then((el) => SecretsSchema.parse({ ...el, id: el.secretId })));
|
||||||
|
|||||||
Reference in New Issue
Block a user