Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

review

Andrey3be8f6f36234
diff --git a/backend/src/ee/services/pam-account/pam-account-dal.ts b/backend/src/ee/services/pam-account/pam-account-dal.ts
index 51ca5588a5..5a69b54d14 100644
--- a/backend/src/ee/services/pam-account/pam-account-dal.ts
+++ b/backend/src/ee/services/pam-account/pam-account-dal.ts
@@ -82,6 +82,7 @@ export const accountAccessibilitySql = (accountTable: string, templateTable: str
type TPamAccountTemplateInheritedFields = {
credentialConfigured: boolean;
+ encryptedCredentials: Buffer;
templateGatewayId: string | null;
templateGatewayPoolId: string | null;
templateRecordingConnectionId: string | null;
@@ -191,6 +192,7 @@ export const pamAccountDALFactory = (db: TDbClient) => {
`${TableName.PamAccount}.recordingConnectionId`,
`${TableName.PamAccount}.settingsOverrides`,
`${TableName.PamAccount}.credentialConfigured`,
+ `${TableName.PamAccount}.encryptedCredentials`,
`${TableName.PamAccount}.createdAt`,
`${TableName.PamAccount}.updatedAt`,
`${TableName.PamAccountTemplate}.type as accountType`,
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index d193e98d9a..1cbb653c8f 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -248,6 +248,17 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>
...new Set(accountsRequiringApproval.map((a) => a.folderId).filter(Boolean) as string[])
];
+ const { decryptor } = await getProjectCipher(projectId);
+ const revealableById = new Map(
+ accounts.map((a) => [
+ a.id,
+ hasRevealableCredential(
+ a.accountType as PamAccountType,
+ JSON.parse(decryptor({ cipherTextBlob: a.encryptedCredentials }).toString("utf-8")) as Record<string, unknown>
+ )
+ ])
+ );
+
const [accessStatusMap, credentialAccessStatusMap, foldersWithApprovalPolicy, permissionsByAccountId] =
await Promise.all([
deps.pamAccessRequestService.getAccessStatusBatch(
@@ -297,7 +308,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>
accessibilityIssues,
isStale: a.isStale,
requiresApproval,
- supportsCredentialReveal: hasRevealableCredential(a.accountType as PamAccountType),
+ supportsCredentialReveal: revealableById.get(a.id) ?? false,
requireReason,
accessStatus: requiresApproval ? (statusEntry?.accessStatus ?? PamAccessStatus.None) : PamAccessStatus.None,
grantExpiresAt: statusEntry?.grantExpiresAt ?? null,