Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(global-approvals): make canAccess path normalized
x032205c45289ebcfb2
diff --git a/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.ts b/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.tsindex 9cce575d40..dce43e3198 100644--- a/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.ts+++ b/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.ts@@ -68,11 +68,16 @@ export const pamAccessPolicyFactory: TApprovalResourceFactory<revokedAt: null});+ const normalizedAccountPath = inputs.accountPath.startsWith("/") ? inputs.accountPath.slice(1) : inputs.accountPath;+// TODO(andrey): Move some of this check to be part of SQL queryreturn grants.some((grant) => {const grantAttributes = grant.attributes as TPamAccessPolicyInputs;- const isMatch = picomatch(grantAttributes.accountPath);- return isMatch(inputs.accountPath) && (!grant.expiresAt || grant.expiresAt > new Date());+ const normalizedGrantPath = grantAttributes.accountPath.startsWith("/")+ ? grantAttributes.accountPath.slice(1)+ : grantAttributes.accountPath;+ const isMatch = picomatch(normalizedGrantPath);+ return isMatch(normalizedAccountPath) && (!grant.expiresAt || grant.expiresAt > new Date());});};