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
misc: more feedback
Sheen Capadngan4fd2903423a9
diff --git a/backend/e2e-test/routes/v1/agent-vault.spec.ts b/backend/e2e-test/routes/v1/agent-vault.spec.tsindex 65ed7f047a..671b01ced7 100644--- a/backend/e2e-test/routes/v1/agent-vault.spec.ts+++ b/backend/e2e-test/routes/v1/agent-vault.spec.ts@@ -891,6 +891,27 @@ describe("Agent Vault V1 Router", async () => {expect(JSON.parse(moved.payload).service.hostPattern).toBe("mcp.linear.dev");});+ test("an MCP service refuses member-provided credentials, on create and update", async () => {+ const bundle = await createAccessBundle("mcp-member-provided");+ const created = await inject("POST", servicesUrl(bundle.id), {+ type: "mcp",+ name: "linear",+ serverUrl: "https://mcp.linear.app/mcp",+ transport: "streamable-http",+ credential: { type: "bearer", memberProvidedFields: ["credential-value"] }+ });+ expect(created.statusCode).toBe(422);+ expect(created.payload).toContain("MCP services don't support member-provided credentials yet");++ const service = await createMcpService(bundle.id, "linear", "https://mcp.linear.app/mcp");+ const updated = await inject("PATCH", `${servicesUrl(bundle.id)}/${service.id}`, {+ type: "mcp",+ credential: { type: "bearer", memberProvidedFields: ["credential-value"] }+ });+ expect(updated.statusCode).toBe(422);+ expect(updated.payload).toContain("MCP services don't support member-provided credentials yet");+ });+test("a field that belongs to the other type is refused by name, on create and update", async () => {const bundle = await createAccessBundle("mcp-wrong-fields");const mcp = {@@ -976,7 +997,9 @@ describe("Agent Vault V1 Router", async () => {const res = await inject("PATCH", `${servicesUrl(bundle.id)}/${id}`, fields);expect(res.statusCode).toBe(200);const { service } = res.json() as { service: TReadService };- expect(service).toMatchObject(fields);+ // Only the bundle read carries the caller's own personal values, so the update doesn't echo them.+ const { personalValues, ...written } = fields;+ expect(service).toMatchObject(written);}));});@@ -2272,7 +2295,7 @@ describe("Agent Vault V1 Router", async () => {};const createService = async (accessBundleId: string, body: Record<string, unknown>) => {- const res = await inject("POST", servicesUrl(accessBundleId), body);+ const res = await inject("POST", servicesUrl(accessBundleId), { type: "http", ...body });expect(res.statusCode).toBe(200);return (JSON.parse(res.payload) as {@@ -2326,6 +2349,7 @@ describe("Agent Vault V1 Router", async () => {expect(service.credential.memberProvidedFields).toEqual(["credential-value"]);const both = await inject("POST", servicesUrl(bundle.id), {+ type: "http",name: "datadog-both",hostPattern: "api.us5.datadoghq.com",credential: { type: "bearer", value: "admin_value", memberProvidedFields: ["credential-value"] }@@ -2334,6 +2358,7 @@ describe("Agent Vault V1 Router", async () => {// A PATCH that leaves the list out keeps it, so a token sent alongside is refused rather than dropped.const dropped = await inject("PATCH", `${servicesUrl(bundle.id)}/${service.id}`, {+ type: "http",credential: { type: "bearer", value: "admin_value" }});expect(dropped.statusCode).toBe(400);@@ -2523,7 +2548,7 @@ describe("Agent Vault V1 Router", async () => {});expect(service.credential.memberProvidedFields).toEqual(["credential-username"]);const patchService = (credential: Record<string, unknown>) =>- inject("PATCH", `${servicesUrl(bundle.id)}/${service.id}`, { credential });+ inject("PATCH", `${servicesUrl(bundle.id)}/${service.id}`, { type: "http", credential });// Which fields a member has saved for the service, read directly since no response lists them all at once.const storedFields = async () =>(await testDb("agent_vault_personal_values").where({ serviceId: service.id }).select("field"))@@ -3071,6 +3096,7 @@ describe("Agent Vault V1 Router", async () => {).toBe(200);const takeBack = await inject("PATCH", `${servicesUrl(bundle.id)}/${service.id}`, {+ type: "http",credential: { type: "basic", username: "admin-u", password: "admin-p", memberProvidedFields: [] }});expect(takeBack.statusCode).toBe(200);@@ -3143,6 +3169,7 @@ describe("Agent Vault V1 Router", async () => {expect((await inject("PATCH", `${servicesUrl(bundle.id)}/${service.id}`, {+ type: "http",credential: { type: "bearer", memberProvidedFields: ["credential-value"] }})).statusCodediff --git a/backend/src/db/migrations/20261015120000_agent-vault-mcp-services.ts b/backend/src/db/migrations/20261027064312_agent-vault-mcp-services.tssimilarity index 100%rename from backend/src/db/migrations/20261015120000_agent-vault-mcp-services.tsrename to backend/src/db/migrations/20261027064312_agent-vault-mcp-services.tsdiff --git a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-schemas.ts b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-schemas.tsindex 43fa864539..73896bbc27 100644--- a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-schemas.ts+++ b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-schemas.ts@@ -77,10 +77,18 @@ const MEMBER_FIELD_OF_INPUT: Record<"value" | "username" | "password", TAgentVau// Discriminated union options must be plain objects, so the checks that read two fields run on the union.const checkCredentialFields =- ({ requireValues }: { requireValues: boolean }) =>+ ({ requireValues, mcp }: { requireValues: boolean; mcp: boolean }) =>(data: TCredentialShape, ctx: z.RefinementCtx) => {const memberProvided = new Set(data.memberProvidedFields ?? []);+ if (mcp && memberProvided.size) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ["memberProvidedFields"],+ message: "MCP services don't support member-provided credentials yet. Leave memberProvidedFields out."+ });+ }+// A member-provided field has no admin value: each member sends their own.(["value", "username", "password"] as const).forEach((field) => {if (data[field] !== undefined && memberProvided.has(MEMBER_FIELD_OF_INPUT[field])) {@@ -160,7 +168,7 @@ const credentialInputSchema = ({ mcp }: { mcp: boolean }) =>passthroughCredentialInput.describe(docsTitle("Pass-through", mcp)),oauthCredentialInput.describe(docsTitle("OAuth", true))])- .superRefine(checkCredentialFields({ requireValues: true }));+ .superRefine(checkCredentialFields({ requireValues: true, mcp }));export const AgentVaultCredentialInputSchema = credentialInputSchema({ mcp: false });export const AgentVaultMcpCredentialInputSchema = credentialInputSchema({ mcp: true });@@ -207,7 +215,7 @@ const credentialUpdateSchema = ({ mcp }: { mcp: boolean }) =>.describe(docsTitle("OAuth", true))]).superRefine((data, ctx) => {- checkCredentialFields({ requireValues: false })(data, ctx);+ checkCredentialFields({ requireValues: false, mcp })(data, ctx);// A full basic update must still leave a half to send. A partial one is checked against what is stored.if (data.type === AgentVaultCredentialType.Basic &&@@ -285,9 +293,7 @@ export const AgentVaultCustomHeadersInputSchema = AgentVaultCustomHeaderInputSchexport const AgentVaultServerUrlSchema = agentVaultMcpServerUrlSchema.describe(AGENT_VAULT.SERVICE.serverUrl);-export const AgentVaultMcpTransportSchema = z- .nativeEnum(AgentVaultMcpTransport)- .describe(AGENT_VAULT.SERVICE.transport);+const AgentVaultMcpTransportSchema = z.nativeEnum(AgentVaultMcpTransport).describe(AGENT_VAULT.SERVICE.transport);export const AgentVaultCustomHeadersUpdateSchema = AgentVaultCustomHeaderUpdateSchema.array().max(AGENT_VAULT_MAX_CUSTOM_HEADERS)diff --git a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.tsindex 6ff4c38916..fa10af9e72 100644--- a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts+++ b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts@@ -21,6 +21,7 @@ import {import { DatabaseErrorCode } from "@app/lib/error-codes";import { BadRequestError, ConflictError, NotFoundError } from "@app/lib/errors";import { hasPostgresConstraintViolation, hasPostgresErrorCode } from "@app/lib/errors/postgres";+import { shake } from "@app/lib/fn";import { ActorType } from "@app/services/auth/auth-type";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { KmsDataKey } from "@app/services/kms/kms-types";@@ -1176,9 +1177,7 @@ export const agentVaultAccessBundleServiceFactory = (deps: TAgentVaultAccessBund// The fields of the type's config this request sent. Ones left out keep their stored value, so the config// is merged here for the fast checks and again under the lock against the row read there.- const configUpdate = Object.fromEntries(- Object.entries({ serverUrl, transport }).filter(([, value]) => value !== undefined)- );+ const configUpdate = shake({ serverUrl, transport }, (value) => value === undefined);const hasConfigUpdate = Object.keys(configUpdate).length > 0;const deriveHostPattern = (config: TAgentVaultServiceConfig) =>resolveServiceHostPattern(serviceType, config, requestedHostPattern);diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-client-fns.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-client-fns.tsindex de143962a5..1385cfb46a 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-client-fns.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-client-fns.ts@@ -1,20 +1,20 @@import { logger } from "@app/lib/logger";+import { OauthGrantType } from "@app/services/oauth-client/oauth-client-types";import { describeServer } from "./agent-vault-oauth-discovery-fns";-import { TOauthHttpClient } from "./agent-vault-oauth-http-fns";+import { TOauthHttpClient, withTimeout } from "./agent-vault-oauth-http-fns";import {MAX_ERROR_CODE_LENGTH,MAX_ERROR_DESCRIPTION_LENGTH,normalizeProviderText,OAUTH_VSCHAR_PATTERN} from "./agent-vault-oauth-token-fns";-import {- AGENT_VAULT_OAUTH_GRANT_TYPE,- AgentVaultOauthClientAuthMethod,- AgentVaultOauthCompatibility-} from "./agent-vault-oauth-types";+import { AgentVaultOauthClientAuthMethod, AgentVaultOauthCompatibility } from "./agent-vault-oauth-types";++const AGENT_VAULT_OAUTH_CLIENT_NAME = "Infisical Agent Vault";-export const AGENT_VAULT_OAUTH_CLIENT_NAME = "Infisical Agent Vault";+// Shared by both registration attempts, so authorization creation answers well inside the gateway timeout.+const REGISTRATION_BUDGET_MS = 15_000;export type TOauthClient = {clientId: string;@@ -101,7 +101,7 @@ export const registerOauthClient = async ({grantTypesSupported: string[] | null;tokenEndpointAuthMethodsSupported: string[] | null;}): Promise<{ client: TOauthClient; compatibility: AgentVaultOauthCompatibility[] }> => {- const refreshSupported = !grantTypesSupported || grantTypesSupported.includes("refresh_token");+ const refreshSupported = !grantTypesSupported || grantTypesSupported.includes(OauthGrantType.RefreshToken);const publicClientSupported =!tokenEndpointAuthMethodsSupported ||tokenEndpointAuthMethodsSupported.includes(AgentVaultOauthClientAuthMethod.None);@@ -111,11 +111,14 @@ export const registerOauthClient = async ({token_endpoint_auth_method: publicClientSupported? AgentVaultOauthClientAuthMethod.None: secretAuthMethod(tokenEndpointAuthMethodsSupported),- grant_types: refreshSupported ? [AGENT_VAULT_OAUTH_GRANT_TYPE, "refresh_token"] : [AGENT_VAULT_OAUTH_GRANT_TYPE],+ grant_types: refreshSupported+ ? [OauthGrantType.AuthorizationCode, OauthGrantType.RefreshToken]+ : [OauthGrantType.AuthorizationCode],response_types: ["code"]};const full = { ...minimal, application_type: "web" };+ const deadline = Date.now() + REGISTRATION_BUDGET_MS;let lastStatus: number | null = null;let lastReason = "";// eslint-disable-next-line no-restricted-syntax@@ -123,7 +126,7 @@ export const registerOauthClient = async ({let response;try {// eslint-disable-next-line no-await-in-loop- response = await http.postJson(registrationEndpoint, body);+ response = await withTimeout(http.postJson(registrationEndpoint, body), Math.max(1, deadline - Date.now()));} catch {logger.info(`agentVaultOauth: client registration unreachable [server=${describeServer(serverUrl)}]`);throw new OauthRegistrationError("its registration endpoint couldn't be reached.", null);diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.test.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.test.tsindex 7a0139478c..15afd3503c 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.test.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.test.ts@@ -524,6 +524,27 @@ describe("discovering an MCP server's authorization server", () => {);});+ test("an authorization server that is down is reported instead of guessing its endpoints", async () => {+ const { http } = stubHttp({+ json: {+ "https://mcp.example.com/.well-known/oauth-protected-resource/mcp": {+ resource: "https://mcp.example.com/mcp",+ authorization_servers: ["https://login.example.com/tenant"]+ }+ }+ });+ const outage: TOauthHttpClient = {+ ...http,+ get: async (url) =>+ url.startsWith("https://login.example.com")+ ? { status: 503, contentType: "text/plain", body: "unavailable" }+ : http.get(url)+ };+ await expect(discoverOauthServer(outage, "https://mcp.example.com/mcp")).rejects.toThrow(+ "Couldn't reach the authorization server 'login.example.com'. Try again in a few minutes."+ );+ });+test("a server that answers without any OAuth signal is not advertised, but still gets guessed endpoints", async () => {const { http } = stubHttp({ challenge: null, json: {} });const discovery = await discoverOauthServer(http, "https://mcp.example.com/mcp");diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.tsindex f0b8597ea6..c15e11572f 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-discovery-fns.ts@@ -114,14 +114,20 @@ const parseJsonObject = (response: TOauthHttpResponse): Record<string, unknown>}};-type TFetchedJson = { answered: boolean; json: Record<string, unknown> | null };+// `temporary` separates an outage (no answer, 429 or 5xx) from metadata the server doesn't have.+type TFetchedJson = { answered: boolean; temporary: boolean; json: Record<string, unknown> | null };const fetchJson = async (http: TOauthHttpClient, url: string): Promise<TFetchedJson> => {try {- return { answered: true, json: parseJsonObject(await http.get(url)) };+ const response = await http.get(url);+ return {+ answered: true,+ temporary: response.status === 429 || response.status >= 500,+ json: parseJsonObject(response)+ };} catch {logger.info(`agentVaultOauth: metadata fetch failed [url=${sanitizeUrlForLog(url)}]`);- return { answered: false, json: null };+ return { answered: false, temporary: true, json: null };}};@@ -295,13 +301,14 @@ const discover = async (http: TOauthHttpClient, serverUrl: string): Promise<TOaucompatibility.add(AgentVaultOauthCompatibility.NoProtectedResourceMetadata);}- const metadata =- (- await firstUsableInOrder(- authorizationServerMetadataUrls(issuer).map((url) => fetchJson(http, url)),- (result) => Boolean(result.json)- )- )?.json ?? null;+ const metadataFetches = authorizationServerMetadataUrls(issuer).map((url) => fetchJson(http, url));+ const metadata = (await firstUsableInOrder(metadataFetches, (result) => Boolean(result.json)))?.json ?? null;+ // Guessed endpoints are for servers without metadata; during an outage they would send sign-in to the wrong URL.+ if (!metadata && (await Promise.all(metadataFetches)).every((result) => result.temporary)) {+ throw new BadRequestError({+ message: `Couldn't reach the authorization server '${describeServer(issuer)}'. Try again in a few minutes.`+ });+ }const scopes = selectScopes({challengeScope: challenge?.scope,diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-http-fns.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-http-fns.tsindex 6bfd951c97..d5a70cd838 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-http-fns.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-http-fns.ts@@ -23,6 +23,17 @@ export type TOauthHttpClient = {};const TIMEOUT_MS = 10_000;++// Also bounds what the HTTP client's own timeout doesn't cover, such as resolving and validating the host.+export const withTimeout = <T>(promise: Promise<T>, ms: number) => {+ let timer: NodeJS.Timeout | undefined;+ return Promise.race([+ promise,+ new Promise<never>((_, reject) => {+ timer = setTimeout(() => reject(new Error("OAuth request timed out")), ms);+ })+ ]).finally(() => clearTimeout(timer));+};const MAX_BODY_BYTES = 1024 * 1024;const headerValue = (value: unknown): string => {diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.test.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.test.tsindex 989e930c84..1aa644f112 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.test.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.test.ts@@ -10,6 +10,7 @@ import {import { BadRequestError, ConflictError, NotFoundError } from "@app/lib/errors";import { logger } from "@app/lib/logger";import { ActorType } from "@app/services/auth/auth-type";+import { OauthGrantType } from "@app/services/oauth-client/oauth-client-types";import {AgentVaultCredentialType,@@ -328,7 +329,7 @@ const authorize = async (env: ReturnType<typeof setup>) => {const oauthConfig = (overrides: Partial<TAgentVaultOauthConfig> = {}): TAgentVaultOauthConfig => ({type: AgentVaultCredentialType.OAuth,- grantType: "authorization_code",+ grantType: OauthGrantType.AuthorizationCode,serverUrl: SERVER_URL,issuer: "https://mcp.linear.app",authorizationEndpoint: "https://mcp.linear.app/authorize",@@ -417,20 +418,29 @@ describe("starting an authorization", () => {);});- test("a registration endpoint that can't be reached is logged without the error text", async () => {+ test("a registration endpoint that can't be reached asks to try again, logged without the error text", async () => {vi.mocked(logger.warn).mockClear();const env = setup();env.onRegister(() => {throw new Error("connect ECONNREFUSED https://mcp.linear.app/register?token=abc");});- const result = await createAuthorization(env);- expect(result.registrationRequired).toBe(true);+ await expect(createAuthorization(env)).rejects.toThrow(+ "Couldn't set up OAuth for 'mcp.linear.app': its registration endpoint couldn't be reached. Try again in a few minutes."+ );expect(logger.warn).toHaveBeenCalledWith(`agentVaultOauth: client registration failed [projectId=${PROJECT_ID}] [server=mcp.linear.app] [error=its registration endpoint couldn't be reached.]`);expect(vi.mocked(logger.warn).mock.calls.flat().join()).not.toContain("ECONNREFUSED");});+ test("a registration endpoint that is down asks to try again instead of for a client", async () => {+ const env = setup();+ env.onRegister(() => json(503, { error: "temporarily_unavailable" }));+ await expect(createAuthorization(env)).rejects.toThrow(+ /\(temporarily_unavailable\)\. Try again in a few minutes\.$/+ );+ });+test("an admin-entered client is used as is, with no registration", async () => {const env = setup();const { authorization } = await createAuthorization(env, { clientId: "my-app", clientSecret: "shh" });@@ -1085,7 +1095,9 @@ describe("refreshing a service's token", () => {{ error: "incorrect_client_credentials", status: 200, why: "GitHub's invalid_client, with a 200" },{ error: "invalid_refresh_token", status: 200, why: "Slack, with ok: false" },{ error: "token_revoked", status: 200, why: "Slack" },- { error: "token_expired", status: 200, why: "Slack" }+ { error: "token_expired", status: 200, why: "Slack" },+ { error: "bad_client_secret", status: 200, why: "Slack's invalid_client" },+ { error: "invalid_client_id", status: 200, why: "Slack's invalid_client" }])("$error marks the service as needing reauthorization ($why)", async ({ error, status }) => {env.onToken(() => json(status, { ok: false, error }));const result = await env.service.refreshServiceToken({diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.tsindex 821a9ef9b6..765821a404 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-service.ts@@ -15,6 +15,7 @@ import { ActorType } from "@app/services/auth/auth-type";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { KmsDataKey } from "@app/services/kms/kms-types";import { TMembershipDALFactory } from "@app/services/membership/membership-dal";+import { OauthGrantType } from "@app/services/oauth-client/oauth-client-types";import {AgentVaultCredentialType,@@ -32,7 +33,12 @@ import {registerOauthClient,TOauthClient} from "./agent-vault-oauth-client-fns";-import { describeServer, discoverOauthServer, OFFLINE_ACCESS_SCOPE } from "./agent-vault-oauth-discovery-fns";+import {+ describeServer,+ discoverOauthServer,+ oauthSetupError,+ OFFLINE_ACCESS_SCOPE+} from "./agent-vault-oauth-discovery-fns";import { agentVaultOauthHttpClient, TOauthHttpClient } from "./agent-vault-oauth-http-fns";import {buildAuthorizeUrl,@@ -52,7 +58,6 @@ import {withTokenCompatibility} from "./agent-vault-oauth-token-fns";import {- AGENT_VAULT_OAUTH_GRANT_TYPE,AgentVaultOauthRegistration,TAgentVaultOauthAuthorization,TAgentVaultOauthAuthorizationView,@@ -336,6 +341,7 @@ export const agentVaultOauthServiceFactory = ({let client: TOauthClient | null = null;let registration: AgentVaultOauthRegistration | null = null;+ let temporaryRegistrationError: OauthRegistrationError | null = null;if (clientId) {client = manualOauthClient({clientId,@@ -370,6 +376,8 @@ export const agentVaultOauthServiceFactory = ({logger.warn(`agentVaultOauth: client registration failed [projectId=${projectId}] [server=${describeServer(serverUrl)}] [error=${error.message}]`);+ // An outage at an advertised endpoint says nothing about needing an admin-entered client.+ if (error.status === null || error.status === 429 || error.status >= 500) temporaryRegistrationError = error;}}}@@ -382,6 +390,9 @@ export const agentVaultOauthServiceFactory = ({};registration = reusableStored.config.registration;}+ if (!client && temporaryRegistrationError) {+ throw oauthSetupError(serverUrl, `${temporaryRegistrationError.message} Try again in a few minutes.`);+ }if (!client || !registration) {return {registrationRequired: true,@@ -643,7 +654,7 @@ export const agentVaultOauthServiceFactory = ({return {config: {type: AgentVaultCredentialType.OAuth,- grantType: AGENT_VAULT_OAUTH_GRANT_TYPE,+ grantType: OauthGrantType.AuthorizationCode,serverUrl: record.serverUrl,issuer: record.issuer,authorizationEndpoint: record.authorizationEndpoint,diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.test.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.test.tsindex 3fb9d72f29..a70ee78190 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.test.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.test.ts@@ -263,6 +263,20 @@ describe("token requests", () => {expect((await requestToken({ http, ...tokenArgs })).ok).toBe(false);});+ test("a long secret echoed in the error code is redacted before it is truncated", async () => {+ const refreshToken = `rt-${"x".repeat(160)}`;+ const { http } = stubPosts([json(400, { error: `Refused ${refreshToken}` })]);+ const result = await requestToken({+ http,+ ...tokenArgs,+ params: { grant_type: "refresh_token", refresh_token: refreshToken }+ });+ expect(result.ok).toBe(false);+ if (result.ok) return;+ expect(result.message).not.toContain("xxxxxxxx");+ expect(result.errorCode).not.toContain("xxxxxxxx");+ });+test("provider refusals cannot expose request secrets or their Basic authorization header", async () => {const clientSecret = "client +/secret-with_.*";const encoded = new URLSearchParams({ value: clientSecret }).toString().slice("value=".length);@@ -510,6 +524,15 @@ describe("token types", () => {test.each(["DPoP", "mac", "PoP"])("a %s token is refused, since it needs proof the proxy can't give", (tokenType) => {expect(parseTokenResponse({ access_token: "at", token_type: tokenType })).toBeNull();});++ test("a Slack user token reports the scopes granted under authed_user, not every scope requested", () => {+ const tokens = parseTokenResponse(+ { ok: true, access_token: "xoxp-1", token_type: "user", authed_user: { id: "U123", scope: "openid,email" } },+ ["openid", "email", "profile"]+ );+ expect(tokens?.scopes).toEqual(["openid", "email"]);+ expect(tokens?.scopesCommaSeparated).toBe(true);+ });});describe("text from a provider", () => {diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.tsindex a21543ebdc..7f59ca8d93 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-token-fns.ts@@ -6,6 +6,8 @@ import RE2 from "re2";import { BadRequestError } from "@app/lib/errors";import { logger, sanitizeUrlForLog } from "@app/lib/logger";import { PRIVATE_ADDRESS_REFUSED_MESSAGE } from "@app/lib/validator";+import { computePkceChallenge } from "@app/services/oauth-client/oauth-client-fns";+import { OauthGrantType } from "@app/services/oauth-client/oauth-client-types";import { AgentVaultCredentialType, AgentVaultOauthStatus } from "../agent-vault/agent-vault-enums";import {@@ -15,9 +17,8 @@ import {splitScopes,stripTrailingSlash} from "./agent-vault-oauth-discovery-fns";-import { TOauthHttpClient } from "./agent-vault-oauth-http-fns";+import { TOauthHttpClient, withTimeout } from "./agent-vault-oauth-http-fns";import {- AGENT_VAULT_OAUTH_GRANT_TYPE,AGENT_VAULT_OAUTH_HEADER_NAME,AGENT_VAULT_OAUTH_HEADER_PREFIX,AgentVaultOauthClientAuthMethod,@@ -32,7 +33,7 @@ export const hashAccessToken = (accessToken: string) => crypto.createHash("sha25export const generatePkce = () => {const codeVerifier = base64Url(crypto.randomBytes(32));- const codeChallenge = base64Url(crypto.createHash("sha256").update(codeVerifier).digest());+ const codeChallenge = computePkceChallenge(codeVerifier);return { codeVerifier, codeChallenge };};@@ -186,7 +187,13 @@ export const parseTokenResponse = (}const refreshToken = isUsableToken(body.refresh_token) ? body.refresh_token : undefined;- const { scopes, commaSeparated } = parseGrantedScopes(body.scope, requestedScopes);+ // Slack's user-token response puts the granted scopes under authed_user rather than at the top level.+ const authedUser = body.authed_user;+ const scope =+ typeof body.scope !== "string" && authedUser && typeof authedUser === "object"+ ? (authedUser as Record<string, unknown>).scope+ : body.scope;+ const { scopes, commaSeparated } = parseGrantedScopes(scope, requestedScopes);return {accessToken,refreshToken,@@ -258,17 +265,6 @@ export const normalizeProviderText = (export const TOKEN_REQUEST_BUDGET_MS = 7_000;const MIN_RETRY_BUDGET_MS = 500;-// Also bounds what the HTTP client's own timeout doesn't cover, such as resolving and validating the host.-const withTimeout = <T>(promise: Promise<T>, ms: number) => {- let timer: NodeJS.Timeout | undefined;- return Promise.race([- promise,- new Promise<never>((_, reject) => {- timer = setTimeout(() => reject(new Error("Token request timed out")), ms);- })- ]).finally(() => clearTimeout(timer));-};-export const requestToken = async ({http,issuer,@@ -384,9 +380,10 @@ export const requestToken = async ({};}- const errorCode = normalizeProviderText(body?.error, MAX_ERROR_CODE_LENGTH) || null;+ // Redacted before the cut, since a secret split by truncation would no longer match.+ const errorCode = normalizeProviderText(body?.error, MAX_ERROR_CODE_LENGTH, requestSecrets) || null;const description = normalizeProviderText(body?.error_description, MAX_ERROR_DESCRIPTION_LENGTH, requestSecrets);- const detail = description || normalizeProviderText(errorCode, MAX_ERROR_CODE_LENGTH, requestSecrets);+ const detail = description || errorCode;// A bare 5xx is an outage, not a refusal, and the refresh keeps retrying it.const message =!detail && response.status >= 500@@ -413,7 +410,9 @@ const DEAD_LOGIN_ERROR_CODES = new Set(["bad_refresh_token", // GitHub"invalid_refresh_token", // Slack"token_revoked", // Slack- "token_expired" // Slack+ "token_expired", // Slack+ "bad_client_secret", // Slack's invalid_client+ "invalid_client_id" // Slack's invalid_client]);export const isDeadLoginError = (errorCode: string | null) =>@@ -425,7 +424,7 @@ export const exchangeAuthorizationCode = (requestToken({...args,params: {- grant_type: AGENT_VAULT_OAUTH_GRANT_TYPE,+ grant_type: OauthGrantType.AuthorizationCode,code: args.code,code_verifier: args.codeVerifier,redirect_uri: args.redirectUri@@ -434,7 +433,7 @@ export const exchangeAuthorizationCode = (export const refreshAccessToken = (args: Omit<Parameters<typeof requestToken>[0], "params"> & { refreshToken: string }-) => requestToken({ ...args, params: { grant_type: "refresh_token", refresh_token: args.refreshToken } });+) => requestToken({ ...args, params: { grant_type: OauthGrantType.RefreshToken, refresh_token: args.refreshToken } });export const withTokenCompatibility = (compatibility: AgentVaultOauthCompatibility[],diff --git a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-types.ts b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-types.tsindex af10212ed9..77ebbd2046 100644--- a/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-types.ts+++ b/backend/src/ee/services/agent-vault-oauth/agent-vault-oauth-types.ts@@ -1,4 +1,5 @@import { TGenericPermission } from "@app/lib/types";+import { OauthGrantType } from "@app/services/oauth-client/oauth-client-types";import {AgentVaultCredentialType,@@ -31,15 +32,13 @@ export enum AgentVaultOauthCompatibility {ScopeCommaSeparated = "scope-comma-separated"}-export const AGENT_VAULT_OAUTH_GRANT_TYPE = "authorization_code";-// The MCP authorization spec puts the access token in `Authorization: Bearer`, so it isn't configurable.export const AGENT_VAULT_OAUTH_HEADER_NAME = "Authorization";export const AGENT_VAULT_OAUTH_HEADER_PREFIX = "Bearer";export type TAgentVaultOauthConfig = {type: AgentVaultCredentialType.OAuth;- grantType: typeof AGENT_VAULT_OAUTH_GRANT_TYPE;+ grantType: OauthGrantType.AuthorizationCode;// The server URL the tokens were authorized for.serverUrl: string;issuer: string;diff --git a/backend/src/ee/services/agent-vault/agent-vault-service-type-fns.ts b/backend/src/ee/services/agent-vault/agent-vault-service-type-fns.tsindex 1d3f726e69..0daa6ab1a6 100644--- a/backend/src/ee/services/agent-vault/agent-vault-service-type-fns.ts+++ b/backend/src/ee/services/agent-vault/agent-vault-service-type-fns.ts@@ -2,6 +2,7 @@ import RE2 from "re2";import { z } from "zod";import { BadRequestError } from "@app/lib/errors";+import { shake } from "@app/lib/fn";import {AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE,@@ -77,14 +78,14 @@ export const deriveMcpHostPattern = (serverUrl: string): string => {return url.port && url.port !== AGENT_VAULT_DEFAULT_PORT ? `${host}:${url.port}` : host;};-export const AgentVaultHttpServiceConfigSchema = z.object({});+const AgentVaultHttpServiceConfigSchema = z.object({});-export const AgentVaultMcpServiceConfigSchema = z.object({+const AgentVaultMcpServiceConfigSchema = z.object({serverUrl: agentVaultMcpServerUrlSchema,transport: z.nativeEnum(AgentVaultMcpTransport)});-export type TAgentVaultMcpServiceConfig = z.infer<typeof AgentVaultMcpServiceConfigSchema>;+type TAgentVaultMcpServiceConfig = z.infer<typeof AgentVaultMcpServiceConfigSchema>;export type TAgentVaultServiceConfig =| TAgentVaultMcpServiceConfig@@ -232,7 +233,7 @@ export const buildServiceConfig = (incoming: Record<string, unknown>,stored: unknown = {}): TAgentVaultServiceConfig => {- const sent = Object.fromEntries(Object.entries(incoming).filter(([, value]) => value !== undefined));+ const sent = shake(incoming, (value) => value === undefined);const parsed = definition.configSchema.safeParse({ ...((stored ?? {}) as Record<string, unknown>), ...sent });if (!parsed.success) {const [issue] = parsed.error.issues;diff --git a/docs/documentation/platform/agent-vault/mcp-servers.mdx b/docs/documentation/platform/agent-vault/mcp-servers.mdxindex e60ff8b2c1..c57513a68d 100644--- a/docs/documentation/platform/agent-vault/mcp-servers.mdx+++ b/docs/documentation/platform/agent-vault/mcp-servers.mdx@@ -11,7 +11,7 @@ You add the MCP server to your agent with its real URL and no credentials. When- The [Admin role](/documentation/platform/agent-vault/access-control) in Agent Vault- An [access bundle](/documentation/platform/agent-vault/access-bundles) to add the MCP server to-- An enrolled [proxy](/documentation/platform/agent-vault/proxies#create-and-enroll-a-proxy) that your agent can reach+- A running [proxy](/documentation/platform/agent-vault/proxies#create-a-proxy-and-start-it) that your agent can reach- An account with the MCP server's provider, or a token the server accepts## Add an MCP server@@ -47,7 +47,7 @@ The service covers every request to the server URL's host, whatever the path. If### OAuth-With OAuth, you sign in to the provider once from Infisical. Infisical stores the tokens the provider returns and refreshes the access token before it expires. The proxy only receives the access token, and the agent never receives any token.+With OAuth, you sign in to the provider from Infisical, and Infisical stores the tokens the provider returns. If the provider also returns a refresh token, Infisical renews the access token before the token expires. If the provider doesn't return one, [reauthorize the service](#troubleshooting) when the access token expires or the server rejects it. The proxy only receives the access token, and the agent never receives any token.<Steps><Step>@@ -115,6 +115,8 @@ Infisical won't save a custom header with the same name as the credential's headurl = "https://mcp.linear.app/mcp"```+ Codex connects to remote MCP servers only over Streamable HTTP. If the service uses the SSE transport, use an agent that supports SSE, such as Claude Code.+Don't use `codex mcp add`, which starts the server's OAuth sign-in from the agent, and don't run `codex mcp login` for the server.</Tab><Tab title="OpenCode">@@ -143,7 +145,7 @@ Infisical won't save a custom header with the same name as the credential's head```</Step><Step>- Ask the agent to use one of the server's tools, such as listing your Linear issues. If you've [set up session logs](/documentation/platform/agent-vault/session-logs#setting-up-session-logs), the call appears in the session's logs with the [tool name](/documentation/platform/agent-vault/session-logs#mcp-tool-calls).+ Ask the agent to use one of the server's tools, such as listing your Linear issues. The call appears in the [session's logs](/documentation/platform/agent-vault/session-logs#viewing-session-logs) with the [tool name](/documentation/platform/agent-vault/session-logs#mcp-tool-calls).</Step></Steps>diff --git a/docs/documentation/platform/agent-vault/session-logs.mdx b/docs/documentation/platform/agent-vault/session-logs.mdxindex 7af4bf8fc5..15f57bba69 100644--- a/docs/documentation/platform/agent-vault/session-logs.mdx+++ b/docs/documentation/platform/agent-vault/session-logs.mdx@@ -60,7 +60,7 @@ You can view a session's logs if you created the session or you're an Agent Vaul}```- If a request matched an MCP service, its record also has `serviceType` set to `mcp`, and an `mcp` object with the [calls](#mcp-tool-calls) in the request:+ If a request matched an MCP service, its record has `serviceType` set to `mcp`. If the request was a JSON `POST`, the record also has an `mcp` object with the [calls](#mcp-tool-calls) in the request:```json{@@ -73,7 +73,8 @@ You can view a session's logs if you created the session or you're an Agent Vaul```- `serviceType`: `http` or `mcp`, or `null` if no service matched the request- - `mcp.parsed`: `false` if the proxy couldn't read the calls from the request body+ - `mcp`: left out for other requests to an MCP service, such as the `GET` that opens an event stream+ - `mcp.parsed`: `false` if the proxy couldn't read the calls from the request body, such as a compressed body- `mcp.truncated`: `true` if the request held more than 32 calls and the rest weren't recorded (left out otherwise)</Step></Steps>diff --git a/frontend/src/components/agent-vault/ServiceTemplateSelect.tsx b/frontend/src/components/agent-vault/ServiceTemplateSelect.tsxindex c8081b2a81..f74ad11249 100644--- a/frontend/src/components/agent-vault/ServiceTemplateSelect.tsx+++ b/frontend/src/components/agent-vault/ServiceTemplateSelect.tsx@@ -21,21 +21,17 @@ import {} from "@app/helpers/agentVaultTemplates";import { AgentVaultServiceType } from "@app/hooks/api/agentVault";-enum TypeFilter {- All = "all",- Http = "http",- Mcp = "mcp"-}+type TTypeFilter = AgentVaultServiceType | "all";const MCP_SECTION_DESCRIPTION ="Remote MCP servers. The proxy attaches the credential to requests for them.";const HTTP_SECTION_DESCRIPTION ="Web APIs your agent calls directly. The proxy attaches the credential to requests for their hosts.";-const TYPE_FILTERS: { value: TypeFilter; label: string }[] = [- { value: TypeFilter.All, label: "All Types" },- { value: TypeFilter.Mcp, label: "MCP Servers" },- { value: TypeFilter.Http, label: "HTTP APIs" }+const TYPE_FILTERS: { value: TTypeFilter; label: string }[] = [+ { value: "all", label: "All Types" },+ { value: AgentVaultServiceType.Mcp, label: "MCP Servers" },+ { value: AgentVaultServiceType.Http, label: "HTTP APIs" }];// MCP cards sit under the "MCP Servers" heading, so a tag would only repeat it.@@ -150,10 +146,10 @@ type Props = {export const ServiceTemplateSelect = ({ onSelect }: Props) => {const [search, setSearch] = useState("");- const [typeFilter, setTypeFilter] = useState(TypeFilter.All);+ const [typeFilter, setTypeFilter] = useState<TTypeFilter>("all");- const showsHttp = typeFilter !== TypeFilter.Mcp;- const showsMcp = typeFilter !== TypeFilter.Http;+ const showsHttp = typeFilter !== AgentVaultServiceType.Mcp;+ const showsMcp = typeFilter !== AgentVaultServiceType.Http;const filtered = useMemo(() => {const term = search.trim().toLowerCase();@@ -278,7 +274,7 @@ export const ServiceTemplateSelect = ({ onSelect }: Props) => {<Tabsorientation="vertical"value={typeFilter}- onValueChange={(value) => setTypeFilter(value as TypeFilter)}+ onValueChange={(value) => setTypeFilter(value as TTypeFilter)}><TabsList variant="av" aria-label="Service types">{TYPE_FILTERS.map((filter) => (diff --git a/frontend/src/components/agent-vault/service-sheet/OAuthAuthorizeCard.tsx b/frontend/src/components/agent-vault/service-sheet/OAuthAuthorizeCard.tsxindex 7f8f959da5..7a7c8f110e 100644--- a/frontend/src/components/agent-vault/service-sheet/OAuthAuthorizeCard.tsx+++ b/frontend/src/components/agent-vault/service-sheet/OAuthAuthorizeCard.tsx@@ -152,7 +152,8 @@ export const OAuthAuthorizeCard = ({ accessBundleId, service, onSignInChange }:scopes,clientId = "",clientSecret = "",- rejection = ""+ rejection = "",+ isAutomaticSetupChosen = false] = useWatch({control,name: [@@ -162,7 +163,8 @@ export const OAuthAuthorizeCard = ({ accessBundleId, service, onSignInChange }:"oauthScopes","oauthClientId","oauthClientSecret",- "oauthAuthorizationRejection"+ "oauthAuthorizationRejection",+ "oauthAutomaticSetup"]});const clientIdInputId = useId();@@ -172,7 +174,6 @@ export const OAuthAuthorizeCard = ({ accessBundleId, service, onSignInChange }:const [isUsingOwnApp, setIsUsingOwnApp] = useState(() =>Boolean(getValues("oauthClientId") || getValues("oauthClientSecret")));- const [isAutomaticSetupChosen, setIsAutomaticSetupChosen] = useState(false);const trimmedUrl = serverUrl.trim();const host = hostOf(trimmedUrl);@@ -210,9 +211,14 @@ export const OAuthAuthorizeCard = ({ accessBundleId, service, onSignInChange }:const isOwnApp = wantsOwnApp && !isNewlyAuthorized;const hasAuthorization = isNewlyAuthorized || Boolean(stored);+ const switchToOwnApp = () => {+ setIsUsingOwnApp(true);+ setValue("oauthAutomaticSetup", false);+ };+const switchToAutomaticSetup = () => {setIsUsingOwnApp(false);- setIsAutomaticSetupChosen(true);+ setValue("oauthAutomaticSetup", true);setValue("oauthClientId", "");setValue("oauthClientSecret", "");};@@ -457,7 +463,7 @@ export const OAuthAuthorizeCard = ({ accessBundleId, service, onSignInChange }:type="button"variant="link"size="sm"- onClick={isUsingOwnApp ? switchToAutomaticSetup : () => setIsUsingOwnApp(true)}+ onClick={isUsingOwnApp ? switchToAutomaticSetup : switchToOwnApp}>{isUsingOwnApp ? "Use automatic setup" : "Use your own OAuth app"}</Button>diff --git a/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx b/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsxindex 3d0bd67afe..56f1434a71 100644--- a/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx+++ b/frontend/src/components/agent-vault/service-sheet/ServiceSheet.tsx@@ -107,6 +107,7 @@ const BLANK_SERVICE_FORM: TServiceForm = {oauthAuthorizationRejection: "",oauthClientId: "",oauthClientSecret: "",+ oauthAutomaticSetup: false,memberProvidedFields: [],methods: [...HTTP_METHODS],pathPrefixes: [],@@ -284,7 +285,7 @@ const rejectedAuthorizationMessage = (error: unknown) => {const message = error.response?.data?.message;if (typeof message !== "string") return null;const isRejected =- (status === 400 && /authoriz/i.test(message)) ||+ (status === 400 && message.startsWith("This authorization ")) ||(status === 404 && message.startsWith("Authorization with ID")) ||(status === 409 && message.includes("already used by another save"));return isRejected ? message : null;diff --git a/frontend/src/components/agent-vault/service-sheet/TransformationsFields.tsx b/frontend/src/components/agent-vault/service-sheet/TransformationsFields.tsxindex cd9cd5f33d..fb0801f593 100644--- a/frontend/src/components/agent-vault/service-sheet/TransformationsFields.tsx+++ b/frontend/src/components/agent-vault/service-sheet/TransformationsFields.tsx@@ -72,13 +72,11 @@ const RemoveRowButton = ({export const TransformationsFields = ({openItem,onOpenChange,- label = "Advanced Options",hasSubstitutions = true,children}: {openItem: string;onOpenChange: (item: string) => void;- label?: string;hasSubstitutions?: boolean;children?: ReactNode;}) => {@@ -96,7 +94,7 @@ export const TransformationsFields = ({onValueChange={onOpenChange}><AccordionItem value={ADVANCED_ITEM}>- <AccordionTrigger>{label}</AccordionTrigger>+ <AccordionTrigger>Advanced Options</AccordionTrigger><AccordionContent><div className="flex flex-col gap-5">{children}diff --git a/frontend/src/components/agent-vault/service-sheet/serviceSchema.ts b/frontend/src/components/agent-vault/service-sheet/serviceSchema.tsindex cf5873ff57..98a3717cbf 100644--- a/frontend/src/components/agent-vault/service-sheet/serviceSchema.ts+++ b/frontend/src/components/agent-vault/service-sheet/serviceSchema.ts@@ -307,6 +307,8 @@ export const buildServiceSchema = (// Checked in the refine below, only while OAuth is selected: switching to Bearer keeps these values.oauthClientId: z.string().optional(),oauthClientSecret: z.string().optional(),+ // The admin chose automatic setup over the service's own OAuth app. Kept in the form so it survives Back.+ oauthAutomaticSetup: z.boolean().optional(),// Each member sets these for themselves, so the form holds no value for them.memberProvidedFields: z.array(z.enum([diff --git a/frontend/src/components/agent-vault/service-sheet/stepMeta.ts b/frontend/src/components/agent-vault/service-sheet/stepMeta.tsindex a913c10e75..c2eeae6ac6 100644--- a/frontend/src/components/agent-vault/service-sheet/stepMeta.ts+++ b/frontend/src/components/agent-vault/service-sheet/stepMeta.ts@@ -17,6 +17,8 @@ type StepMeta = {const VARIABLE_TIP ="To use a global variable, type {{ in any value and pick it from the list. The proxy puts the variable's value in its place. For a member-provided field, each member sets their own value, and can use their personal variables there.";+const MCP_VARIABLE_TIP =+ "To use a global variable in the token or a custom header value, type {{ and pick it from the list. The proxy puts the variable's value in its place. For OAuth, paste the client ID and client secret themselves.";const TEMPLATE_STEP: StepMeta = { step: ServiceStep.Template, name: "Template" };@@ -77,7 +79,7 @@ export const MCP_SERVICE_STEPS: StepMeta[] = [rightLabel: "CREDENTIAL",rightDescription:"The proxy authenticates to the MCP server for the agent. The agent can call any tool the server exposes to this credential.",- rightTip: VARIABLE_TIP+ rightTip: MCP_VARIABLE_TIP},REVIEW_STEP];diff --git a/frontend/src/hooks/api/agentVault/queries.tsx b/frontend/src/hooks/api/agentVault/queries.tsxindex e738de6d42..25ddcd75b1 100644--- a/frontend/src/hooks/api/agentVault/queries.tsx+++ b/frontend/src/hooks/api/agentVault/queries.tsx@@ -7,6 +7,7 @@ import { useOrganization } from "@app/context";import { VARIABLE_KEY_MAX_LENGTH, VARIABLE_KEY_RE } from "@app/helpers/agentVaultVariables";import {+ AgentVaultCredentialType,AgentVaultMemberType,AgentVaultOauthAuthorizationStatus,AgentVaultVariableScope@@ -285,7 +286,14 @@ export const useGetAgentVaultAccessBundle = (accessBundleId: string) => {);return data.accessBundle;},- enabled: Boolean(accessBundleId)+ enabled: Boolean(accessBundleId),+ // Token refreshes and missing-scope reports change OAuth status in the background, so the badges would go stale.+ refetchInterval: (query) =>+ query.state.data?.services.some(+ (service) => service.credential.type === AgentVaultCredentialType.OAuth+ )+ ? 30_000+ : false});};diff --git a/frontend/src/hooks/api/agentVault/sessionLogDecrypt.test.ts b/frontend/src/hooks/api/agentVault/sessionLogDecrypt.test.tsindex ccefeb297c..80f4a7def2 100644--- a/frontend/src/hooks/api/agentVault/sessionLogDecrypt.test.ts+++ b/frontend/src/hooks/api/agentVault/sessionLogDecrypt.test.ts@@ -114,7 +114,8 @@ describe("decryptSessionLogPage", () => {};const key = sessionLogChunkKey(page.chunks[0]);- // The same object Go's TestSealMatchesTheBrowserVector seals: the IV, then the ciphertext and tag.+ // Laid out like the object Go's TestSealMatchesTheBrowserVector seals (the IV, then the ciphertext and tag), but+ // with an MCP record the Go vector doesn't have yet, so it isn't byte-for-byte the CLI's output.const sealed = Uint8Array.from(atob("qrvM3e7/ABEiM0RVPLRwxBbgu+W68Br1N9gY1oUy8wjJxQClAtBh0NfJS1UcWOCPn3laS615sIqwFONhPIPNWRI3CA+a5tUJ7aoim0sQkE4d9gzou2mc/AWiCdToVBJPtdumA9jIzh3yAI81YPwcoDXEVnq2+7ooNNJShGdLX95itbrna/t4nFKRKSSgNzbH23eMtSMcSo72puk/2iwh4sVbTKzC2kwvbf1U6Mgd21zkIq2jDKKwhcT6mTfjPivW4FzmmkspQVMoWwANRX+QVyXzrMipZfoq5N/UcUI6/VTBSsIZvF08UTnPeIW+yM1I5hHColwnfZxQ749XdRSAGhFTIDZG4lkYWxDX+Nw+CUFLdEVwfS/W3qlckKhvB9kyNebTACDUjP8tKYDzi23/ps2hEVcDroDq1EvaoBVV9GPqSbOHiIWDQPpWJ/UJG7anF0NIYtFusQI+WW7KbaPlvoSMs7sALLQLLtM2UjlPalynrTcnH+BREzDa3WqOfHlvTdKfUzsTGp7PmtxOGbE5rHzM5ll+kWvixiwSnGPjBJMy7WeEWCPdnnpTIf1NM4mwikgPH3YPsUCLOauO/GcOoAKaMYxeisSZ6C9V/2ifRbLGOFTaPMmwHEzpeHtQiR8wqd2TKpR7PEBSiSTYpaDJKrzJQgr91cpoPgFakuDptDRaJ4eAcxulJ/ICFC8IkH5cRF2hiDJwdFgy17wdNpFGek87ZB+ZXG8IbS/ONkM8KJrszUHvY9PamV46"diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionLogsPanel.utils.ts b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionLogsPanel.utils.tsindex 4cca7aeba3..dac0551e24 100644--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionLogsPanel.utils.ts+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionLogsPanel.utils.ts@@ -133,7 +133,7 @@ export const sessionLogMcpCalls = (export const sessionLogMcpCallsTruncated = (record: TAgentVaultSessionLogRecord) =>sessionLogMcpCalls(record).length > 0 && record.mcp?.truncated === true;-export const mcpCallLabel = (call: TAgentVaultSessionLogMcpCall) =>+const mcpCallLabel = (call: TAgentVaultSessionLogMcpCall) =>call.tool ? `${call.tool} (${call.method})` : call.method;// Only neighbours are merged, so the list still reads in the order the agent sent the calls.