Skip to content

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

Merge branch 'main' into matheus/prevent-duplicate-secret-values

Matheus Nogueirabd0c7a5db317
diff --cc backend/src/keystore/keystore.ts
index 3b0118c256,a3d8072b1b..d8ecc131bc
--- a/backend/src/keystore/keystore.ts
+++ b/backend/src/keystore/keystore.ts
@@@ -37,11 -37,11 +37,12 @@@ export const PgSqlLock =
KmsProjectKeyCreation: (projectId: string) => pgAdvisoryLockHashText(`kms-project-key:${projectId}`),
KmsProjectDataKeyCreation: (projectId: string) => pgAdvisoryLockHashText(`kms-project-data-key:${projectId}`),
ScimGroupUpdate: (groupId: string) => pgAdvisoryLockHashText(`scim-group-update:${groupId}`),
- LastAdminGuard: (scope: "org", scopeId: string) => pgAdvisoryLockHashText(`last-admin-guard:${scope}:${scopeId}`),
+ LastAdminGuard: (scope: "org" | "project", scopeId: string) =>
+ pgAdvisoryLockHashText(`last-admin-guard:${scope}:${scopeId}`),
AuditReportRequest: (projectId: string) => pgAdvisoryLockHashText(`audit-report-request:${projectId}`),
OrgAuditReportRequest: (orgId: string) => pgAdvisoryLockHashText(`audit-report-request:org:${orgId}`),
- OrgAgentProxyConfigInit: (orgId: string) => pgAdvisoryLockHashText(`org-agent-proxy-config-init:${orgId}`)
+ OrgAgentProxyConfigInit: (orgId: string) => pgAdvisoryLockHashText(`org-agent-proxy-config-init:${orgId}`),
+ SecretValueReuseCheck: (projectId: string) => pgAdvisoryLockHashText(`secret-value-reuse-check:${projectId}`)
} as const;
// all the key prefixes used must be set here to avoid conflict
diff --cc backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
index bbcfacbaf6,6aaeb05cdf..e0ed128204
--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
@@@ -212,14 -214,14 +214,22 @@@ export const secretV2BridgeServiceFacto
projectFolderGrantDAL,
orgDAL
}: TSecretV2BridgeServiceFactoryDep) => {
+ // A duplicate-value violation may only name where the value is already used when the writer can read there.
+ const $canDescribeSecretAt =
+ (permission: MongoAbility<ProjectPermissionSet>) => (environment: string, secretPath: string) =>
+ permission.can(
+ ProjectPermissionSecretActions.DescribeSecret,
+ subject(ProjectPermissionSub.Secrets, { environment, secretPath })
+ );
+
+ const { getSecretMetadata } = secretMetadataServiceFactory({
+ permissionService,
+ folderDAL,
+ projectEnvDAL,
+ projectDAL,
+ secretDAL,
+ keyStore
+ });
const $validateSecretReferences = async (
projectId: string,
permission: MongoAbility<ProjectPermissionSet>,