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(agent-vault): echo the user's ID or email as sent in the bundle refusal
Scott Wilsona6954fc824fa
diff --git a/backend/e2e-test/routes/v1/agent-vault.spec.ts b/backend/e2e-test/routes/v1/agent-vault.spec.tsindex eee4cea4ec..18991097c7 100644--- a/backend/e2e-test/routes/v1/agent-vault.spec.ts+++ b/backend/e2e-test/routes/v1/agent-vault.spec.ts@@ -4084,9 +4084,16 @@ describe("Agent Vault V1 Router", async () => {);});- const notTheirs = await mintFor(bot, { userId: alice.userId }, botsOnly.name);- expect(notTheirs.statusCode).toBe(400);- expect(notTheirs.json().message).toBe(+ // The refusal names the user the way the request did.+ const [byId, byEmail] = await Promise.all([+ mintFor(bot, { userId: alice.userId }, botsOnly.name),+ mintFor(bot, { userEmail: alice.username }, botsOnly.name)+ ]);+ expect([byId.statusCode, byEmail.statusCode]).toEqual([400, 400]);+ expect(byId.json().message).toBe(+ `No access bundle named '${botsOnly.name}' is granted to '${alice.userId}'. Check the name, or ask an Agent Vault admin to grant it to them.`+ );+ expect(byEmail.json().message).toBe(`No access bundle named '${botsOnly.name}' is granted to '${alice.username}'. Check the name, or ask an Agent Vault admin to grant it to them.`);} finally {diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-service.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-service.tsindex d077570c13..24a2bf9f87 100644--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-service.ts+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-service.ts@@ -167,7 +167,7 @@ export const agentVaultSessionServiceFactory = ({});}- return { user, accessBundleIds: reachability.accessBundleIds };+ return { user, identifier, accessBundleIds: reachability.accessBundleIds };};const resolveSessionTtl = (ttl: string | undefined, isOnBehalfOf: boolean) => {@@ -244,7 +244,7 @@ export const agentVaultSessionServiceFactory = ({const notGrantedToUser = firstUnreachable(onBehalfOfUser.accessBundleIds);if (notGrantedToUser) {throw new BadRequestError({- message: `No access bundle named '${notGrantedToUser}' is granted to '${onBehalfOfUser.user.username}'. Check the name, or ask an Agent Vault admin to grant it to them.`+ message: `No access bundle named '${notGrantedToUser}' is granted to '${onBehalfOfUser.identifier}'. Check the name, or ask an Agent Vault admin to grant it to them.`});}} else {