Skip to content

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

fix(agent-vault): address review of inline services

Scott Wilsonee99680b3d40
diff --git a/backend/e2e-test/routes/v1/agent-vault.spec.ts b/backend/e2e-test/routes/v1/agent-vault.spec.ts
index 4c7e52206d..45339bb063 100644
--- a/backend/e2e-test/routes/v1/agent-vault.spec.ts
+++ b/backend/e2e-test/routes/v1/agent-vault.spec.ts
@@ -21,7 +21,10 @@ import {
} from "@app/ee/services/agent-vault-proxy/agent-vault-proxy-service";
import { agentVaultResolveDALFactory } from "@app/ee/services/agent-vault-proxy/agent-vault-resolve-dal";
import { agentVaultSessionDALFactory } from "@app/ee/services/agent-vault-session/agent-vault-session-dal";
-import { agentVaultSessionInlineServiceDALFactory } from "@app/ee/services/agent-vault-session/agent-vault-session-inline-service-dal";
+import {
+ agentVaultSessionInlineServiceDALFactory,
+ DELETE_SECRETS_BATCH_SIZE
+} from "@app/ee/services/agent-vault-session/agent-vault-session-inline-service-dal";
import { agentVaultSessionLogConfigDALFactory } from "@app/ee/services/agent-vault-session-log/agent-vault-session-log-config-dal";
import { AGENT_VAULT_MAX_SKILLS } from "@app/ee/services/agent-vault-skill/agent-vault-skill-fns";
import { agentVaultVariableDALFactory } from "@app/ee/services/agent-vault-variable/agent-vault-variable-dal";
@@ -5722,7 +5725,8 @@ describe("Agent Vault V1 Router", async () => {
credential: { type: "bearer", headerName: "Authorization", headerPrefix: "Bearer" }
},
{
- name: null,
+ // Sent without a name, so it goes by its first host.
+ name: "api.stripe.com",
hostPattern: "api.stripe.com,files.stripe.com",
credential: { type: "basic" },
customHeaders: [{ name: "Stripe-Account", prefix: "" }],
@@ -5854,7 +5858,7 @@ describe("Agent Vault V1 Router", async () => {
});
expect(clash.statusCode).toBe(400);
expect(clash.json().message).toBe(
- `Service 'openai' covers api.github.com:443, which 'github' in the access bundle '${bundle.name}' already covers. Remove it from 'openai'.`
+ `The service 'openai' covers api.github.com:443, which 'github' in the access bundle '${bundle.name}' already covers. Remove it from the service 'openai'.`
);
// A wildcard beside the bundle's exact host is how an override is written, as within one bundle.
@@ -6002,19 +6006,70 @@ describe("Agent Vault V1 Router", async () => {
expect(res.statusCode).toBe(200);
return res.json().session as { id: string };
};
- const expired = await mintInline();
- const live = await mintInline();
+ const [expired, revoked, ownerless, onBehalfOfDeletedUser, live] = await Promise.all(
+ Array.from({ length: 5 }, mintInline)
+ );
+ const bot = await createMemberIdentity(`inline-cleanup-${Date.now()}`);
+ try {
+ await testDb("agent_vault_sessions")
+ .where({ id: expired.id })
+ .update({ expiresAt: new Date(Date.now() - 1000) });
+ // Set directly, as a revoke from an older pod would, so only the cleanup can delete the secrets.
+ await testDb("agent_vault_sessions").where({ id: revoked.id }).update({ revokedAt: new Date() });
+ // What deleting the owner leaves behind.
+ await testDb("agent_vault_sessions").where({ id: ownerless.id }).update({ userId: null });
+ // What deleting the user a machine identity's session was on behalf of leaves behind.
+ await testDb("agent_vault_sessions").where({ id: onBehalfOfDeletedUser.id }).update({
+ userId: null,
+ identityId: bot.id,
+ actorType: "machineIdentity",
+ onBehalfOfUserName: "Deleted User",
+ onBehalfOfUserId: null
+ });
+
+ await agentVaultSessionInlineServiceDALFactory(testDb).deleteSecretsOfEndedSessions();
+
+ const secretsOf = async (sessionId: string) =>
+ ((await testDb(inlineServicesTable).where({ sessionId }).first()) as { encryptedSecrets: Buffer | null })
+ .encryptedSecrets;
+ expect(await secretsOf(expired.id)).toBeNull();
+ expect(await secretsOf(revoked.id)).toBeNull();
+ expect(await secretsOf(ownerless.id)).toBeNull();
+ expect(await secretsOf(onBehalfOfDeletedUser.id)).toBeNull();
+ expect(await secretsOf(live.id)).not.toBeNull();
+ } finally {
+ await bot.cleanup();
+ }
+ });
+
+ test("the hourly cleanup works through more ended services than one batch holds", async () => {
+ const res = await inject("POST", sessionsUrl, { ttl: "1h", services: [openai] });
+ expect(res.statusCode).toBe(200);
+ const { id: sessionId } = res.json().session as { id: string };
+ const [template] = await testDb(inlineServicesTable).where({ sessionId });
+ const { id: _id, createdAt: _createdAt, updatedAt: _updatedAt, ...copy } = template as Record<string, unknown>;
+ await testDb.batchInsert(
+ inlineServicesTable,
+ Array.from({ length: DELETE_SECRETS_BATCH_SIZE }, (_, index) => ({
+ ...copy,
+ position: index + 1,
+ customHeaders: JSON.stringify(copy.customHeaders),
+ substitutions: JSON.stringify(copy.substitutions)
+ })),
+ 500
+ );
await testDb("agent_vault_sessions")
- .where({ id: expired.id })
+ .where({ id: sessionId })
.update({ expiresAt: new Date(Date.now() - 1000) });
await agentVaultSessionInlineServiceDALFactory(testDb).deleteSecretsOfEndedSessions();
- const secretsOf = async (sessionId: string) =>
- ((await testDb(inlineServicesTable).where({ sessionId }).first()) as { encryptedSecrets: Buffer | null })
- .encryptedSecrets;
- expect(await secretsOf(expired.id)).toBeNull();
- expect(await secretsOf(live.id)).not.toBeNull();
+ const [{ count }] = await testDb(inlineServicesTable)
+ .where({ sessionId })
+ .whereNotNull("encryptedSecrets")
+ .count("id as count");
+ expect(Number(count)).toBe(0);
+ await testDb("agent_vault_sessions").where({ id: sessionId }).delete();
});
});
@@ -7473,6 +7528,32 @@ describe("Agent Vault V1 Router", async () => {
expect((await asProxy(created.proxyToken, "heartbeat")).statusCode).toBe(200);
});
+ // A released CLI blocks only under bundle-hosts, so proxies keep getting that name until every CLI knows the new one.
+ test("service-hosts and its old name bundle-hosts are one policy, which proxies still get as bundle-hosts", async () => {
+ const created = await inject("POST", "/api/v1/agent-vault/proxies", {
+ name: "policy-service-hosts",
+ trafficPolicy: "service-hosts"
+ });
+ expect(created.statusCode).toBe(200);
+ const { proxy, proxyToken } = created.json() as { proxy: { id: string; trafficPolicy: string }; proxyToken: string };
+ expect(proxy.trafficPolicy).toBe("service-hosts");
+ expect((await testDb("agent_vault_proxies").where({ id: proxy.id }).first()).trafficPolicy).toBe("bundle-hosts");
+ expect((await asProxy(proxyToken, "bootstrap", {})).json().config.trafficPolicy).toBe("bundle-hosts");
+
+ const update = (trafficPolicy: string) =>
+ inject("PATCH", `/api/v1/agent-vault/proxies/${proxy.id}`, { trafficPolicy });
+ expect((await update("any-host")).json().proxy.trafficPolicy).toBe("any-host");
+ const oldName = await update("bundle-hosts");
+ expect(oldName.statusCode).toBe(200);
+ expect(oldName.json().proxy.trafficPolicy).toBe("service-hosts");
+
+ const listed = (await inject("GET", "/api/v1/agent-vault/proxies")).json() as {
+ proxies: { id: string; trafficPolicy: string }[];
+ };
+ expect(listed.proxies.find((listedProxy) => listedProxy.id === proxy.id)?.trafficPolicy).toBe("service-hosts");
+ expect((await asProxy(proxyToken, "heartbeat")).json().config.trafficPolicy).toBe("bundle-hosts");
+ });
+
test("the generated CA is a P-256 CA valid for about ten years", async () => {
const created = await createProxy("token-ca-shape");
const { rootCa } = JSON.parse((await asProxy(created.proxyToken, "bootstrap", {})).payload) as {
diff --git a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-agent-router.ts b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-agent-router.ts
index e0a4c0d2c0..9334c0d67f 100644
--- a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-agent-router.ts
+++ b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-agent-router.ts
@@ -33,7 +33,10 @@ import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { AgentVaultHostPatternSchema } from "./agent-vault-schemas";
const ProxyConfigSchema = z.object({
- trafficPolicy: z.nativeEnum(AgentVaultTrafficPolicy).describe(AGENT_VAULT.PROXY.trafficPolicy),
+ // Proxies still get the old name: a released CLI lets every host through under a value it doesn't know.
+ trafficPolicy: z
+ .enum([AgentVaultTrafficPolicy.AnyHost, AgentVaultTrafficPolicy.BundleHosts])
+ .describe(AGENT_VAULT.PROXY.trafficPolicyProxy),
allowedHosts: z.string().nullable().describe(AGENT_VAULT.PROXY.allowedHosts),
pollInterval: z.number().describe(AGENT_VAULT.PROXY.pollInterval)
});
diff --git a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-router.ts b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-router.ts
index 7978ee087e..3b4590864e 100644
--- a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-router.ts
+++ b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-proxy-router.ts
@@ -26,7 +26,9 @@ const ProxyMemberViewSchema = z.object({
});
const ProxyAdminViewSchema = ProxyMemberViewSchema.extend({
- trafficPolicy: z.nativeEnum(AgentVaultTrafficPolicy).describe(AGENT_VAULT.PROXY.trafficPolicy),
+ trafficPolicy: z
+ .enum([AgentVaultTrafficPolicy.AnyHost, AgentVaultTrafficPolicy.ServiceHosts])
+ .describe(AGENT_VAULT.PROXY.trafficPolicyRead),
allowedHosts: z.string().nullable().describe(AGENT_VAULT.PROXY.allowedHosts),
pollInterval: z.number().describe(AGENT_VAULT.PROXY.pollInterval),
createdAt: z.date().describe(AGENT_VAULT.PROXY.createdAt)
@@ -173,7 +175,12 @@ export const registerAgentVaultProxyRouter = async (server: FastifyZodProvider)
projectId: req.internalAgentVaultProjectId,
event: {
type: EventType.AGENT_VAULT_PROXY_UPDATE,
- metadata: { proxyId: proxy.id, ...req.body }
+ // The policy as the proxy now reports it, so an audit log never shows the old name.
+ metadata: {
+ proxyId: proxy.id,
+ ...req.body,
+ ...(req.body.trafficPolicy && { trafficPolicy: proxy.trafficPolicy })
+ }
}
});
diff --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.ts
index adf7877a03..266289bf7a 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
@@ -513,7 +513,7 @@ export const AgentVaultInlineServicesInputSchema = AgentVaultInlineServiceInputS
// The sealed values are never in here, and the serializer emits only what this schema lists.
export const AgentVaultInlineServiceSchema = z.object({
id: z.string().uuid().describe(AGENT_VAULT.SESSION.inlineServiceId),
- name: z.string().nullable().describe(AGENT_VAULT.SESSION.inlineServiceNameRead),
+ name: z.string().describe(AGENT_VAULT.SESSION.inlineServiceNameRead),
type: z.nativeEnum(AgentVaultServiceType).describe(AGENT_VAULT.SERVICE.type),
serverUrl: z.string().nullable().describe(AGENT_VAULT.SERVICE.serverUrlRead),
transport: z.nativeEnum(AgentVaultMcpTransport).nullable().describe(AGENT_VAULT.SERVICE.transportRead),
diff --git a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts
index fa4832b685..70c4a1dd10 100644
--- a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts
+++ b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts
@@ -66,7 +66,7 @@ const SessionWithAccessBundlesSchema = SessionSchema.extend({
});
// Whole-body examples, so the docs show the usual session, one access bundle and no services of its own, rather
-// than one generated from every optional field.
+// than one generated from every optional field. Responses always carry services, so the examples show it empty.
const EXAMPLE_ACCESS_BUNDLE = { id: "3c90c3cc-0d44-4b50-8888-8dd25736052a", name: "prod-deploy", position: 0 };
const EXAMPLE_SESSION = {
@@ -78,7 +78,8 @@ const EXAMPLE_SESSION = {
expiresAt: "2026-11-01T02:00:00.000Z",
revokedAt: null,
createdAt: "2026-10-31T18:00:00.000Z",
- accessBundles: [EXAMPLE_ACCESS_BUNDLE]
+ accessBundles: [EXAMPLE_ACCESS_BUNDLE],
+ services: []
};
const docsExample = (example: unknown) => JSON.stringify({ example });
@@ -256,7 +257,8 @@ export const registerAgentVaultSessionRouter = async (server: FastifyZodProvider
token: "agv_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
expiresAt: EXAMPLE_SESSION.expiresAt,
createdAt: EXAMPLE_SESSION.createdAt,
- accessBundles: [EXAMPLE_ACCESS_BUNDLE]
+ accessBundles: [EXAMPLE_ACCESS_BUNDLE],
+ services: []
}
})
)
diff --git a/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.test.ts b/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.test.ts
index f1ee98b72b..f5eb97a7fd 100644
--- a/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.test.ts
+++ b/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.test.ts
@@ -1,6 +1,7 @@
import { createMongoAbility } from "@casl/ability";
import { describe, expect, test, vi } from "vitest";
+import { TAgentVaultSessionInlineServices } from "@app/db/schemas";
import {
ProjectPermissionAgentVaultSessionActions,
ProjectPermissionSub
@@ -62,10 +63,18 @@ const sessionLogConfig = {
const setup = (
refresh: (dto: TRefreshServiceTokenDTO) => Promise<unknown>,
rows = [serviceRow()],
- variables: { id: string; encryptedValue: Buffer }[] = []
+ variables: { id: string; encryptedValue: Buffer }[] = [],
+ {
+ inlineRows = [],
+ isOwnerAdmin = true
+ }: { inlineRows?: TAgentVaultSessionInlineServices[]; isOwnerAdmin?: boolean } = {}
) => {
const refreshServiceToken = vi.fn(refresh);
const reportMissingScopes = vi.fn(async () => {});
+ const findInlineServices = vi.fn(async () => inlineRows);
+ const createCipherPairWithDataKey = vi.fn(
+ async () => ({ decryptor: ({ cipherTextBlob }: { cipherTextBlob: Buffer }) => cipherTextBlob }) as never
+ );
const service = agentVaultProxyServiceFactory({
agentVaultProxyDAL: {
findByIdWithOrg: async () => ({ projectId: PROJECT_ID, orgId: "org-1", pollInterval: 60 })
@@ -79,7 +88,7 @@ const setup = (
findByTokenHash: async () =>
({ id: "session-1", projectId: PROJECT_ID, userId: "user-1", revokedAt: null, expiresAt: null }) as never
},
- agentVaultSessionInlineServiceDAL: { findBySessionId: async () => [] },
+ agentVaultSessionInlineServiceDAL: { findBySessionId: findInlineServices },
agentVaultDelegationDAL: { identityCoversUser: async () => false },
agentVaultSessionLogConfigDAL: {
findOne: async () => sessionLogConfig,
@@ -98,14 +107,11 @@ const setup = (
subject: ProjectPermissionSub.AgentVaultSessions
}
]),
- hasRole: () => true,
+ hasRole: () => isOwnerAdmin,
memberships: []
}) as never
},
- kmsService: {
- createCipherPairWithDataKey: async () =>
- ({ decryptor: ({ cipherTextBlob }: { cipherTextBlob: Buffer }) => cipherTextBlob }) as never
- },
+ kmsService: { createCipherPairWithDataKey },
licenseService: {} as never,
resourceAuthMethodService: {} as never,
agentVaultOauthService: {
@@ -113,7 +119,7 @@ const setup = (
reportMissingScopes: reportMissingScopes as never
}
});
- return { service, refreshServiceToken, reportMissingScopes };
+ return { service, refreshServiceToken, reportMissingScopes, findInlineServices, createCipherPairWithDataKey };
};
const refreshed = {
@@ -429,3 +435,80 @@ describe("resolve for a session on a user's behalf", () => {
await expect(resolve()).rejects.toThrow(UnauthorizedError);
});
});
+
+describe("resolve with inline services", () => {
+ const resolve = (service: ReturnType<typeof setup>["service"]) =>
+ service.resolveSession({ proxyId: "proxy-1", orgId: "org-1", sessionToken: "token", hasSessionLogKey: false });
+ const noRefresh = async () => {
+ throw new Error("nothing here needs a refresh");
+ };
+
+ const passthroughBundleRow = serviceRow({
+ name: "bundle-api",
+ type: AgentVaultServiceType.Http,
+ hostPattern: "api.example.com",
+ config: {},
+ credentialType: AgentVaultCredentialType.Passthrough,
+ credentialConfig: {},
+ encryptedCredential: null
+ });
+
+ const inlineRow = (overrides: Partial<TAgentVaultSessionInlineServices> = {}): TAgentVaultSessionInlineServices => ({
+ id: "inline-1",
+ sessionId: "session-1",
+ position: 0,
+ name: "inline-api",
+ type: AgentVaultServiceType.Http,
+ config: {},
+ hostPattern: "api.example.com",
+ allowedMethods: null,
+ allowedPathPrefixes: null,
+ credentialType: AgentVaultCredentialType.Bearer,
+ credentialConfig: { type: AgentVaultCredentialType.Bearer, headerName: "Authorization", headerPrefix: "Bearer" },
+ customHeaders: [],
+ substitutions: [],
+ // The test's decryptor hands the blob back as it is.
+ encryptedSecrets: Buffer.from(
+ JSON.stringify({ credential: { value: "inline-token" }, customHeaders: [], substitutions: [] })
+ ),
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ ...overrides
+ });
+
+ // The proxy picks the first of two equally specific matches, so the bundle's service wins a host both cover.
+ test("sends the inline services after the access bundle's", async () => {
+ const { service } = setup(noRefresh, [passthroughBundleRow], [], { inlineRows: [inlineRow()] });
+ const { services } = await resolve(service);
+ expect(services.map((resolved) => resolved.name)).toEqual(["bundle-api", "inline-api"]);
+ expect(services[1]).toMatchObject({ accessBundleName: null, credential: { value: "inline-token" } });
+ });
+
+ test("leaves the inline services out once the session's owner isn't an admin", async () => {
+ const { service, findInlineServices } = setup(noRefresh, [passthroughBundleRow], [], {
+ inlineRows: [inlineRow()],
+ isOwnerAdmin: false
+ });
+ const { services } = await resolve(service);
+ expect(services.map((resolved) => resolved.name)).toEqual(["bundle-api"]);
+ expect(findInlineServices).not.toHaveBeenCalled();
+ });
+
+ test("derives the data key only when an inline service has something sealed", async () => {
+ const unsealed = setup(noRefresh, [passthroughBundleRow], [], {
+ inlineRows: [
+ inlineRow({
+ credentialType: AgentVaultCredentialType.Passthrough,
+ credentialConfig: { type: AgentVaultCredentialType.Passthrough },
+ encryptedSecrets: null
+ })
+ ]
+ });
+ expect((await resolve(unsealed.service)).services).toHaveLength(2);
+ expect(unsealed.createCipherPairWithDataKey).not.toHaveBeenCalled();
+
+ const sealed = setup(noRefresh, [passthroughBundleRow], [], { inlineRows: [inlineRow()] });
+ await resolve(sealed.service);
+ expect(sealed.createCipherPairWithDataKey).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.ts b/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.ts
index 68bb61870c..25671b2ab7 100644
--- a/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.ts
+++ b/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-service.ts
@@ -64,7 +64,9 @@ import {
AgentVaultServiceType,
AgentVaultTrafficPolicy,
AgentVaultVariableReferenceField,
- TAgentVaultMemberProvidedField
+ TAgentVaultMemberProvidedField,
+ toStoredTrafficPolicy,
+ toTrafficPolicyView
} from "../agent-vault/agent-vault-enums";
import { TAgentVaultOwner } from "../agent-vault/agent-vault-owner-fns";
import {
@@ -197,7 +199,7 @@ export const agentVaultProxyServiceFactory = ({
};
const toConfig = (proxy: TAgentVaultProxies): TAgentVaultProxyConfig => ({
- trafficPolicy: proxy.trafficPolicy as AgentVaultTrafficPolicy,
+ trafficPolicy: toStoredTrafficPolicy(proxy.trafficPolicy as AgentVaultTrafficPolicy),
allowedHosts: proxy.allowedHosts ?? null,
pollInterval: proxy.pollInterval
});
@@ -211,11 +213,15 @@ export const agentVaultProxyServiceFactory = ({
rootCaExpiresAt: proxy.rootCaExpiresAt ?? null
});
- const toAdminView = (proxy: TAgentVaultProxies) => ({
- ...toMemberView(proxy),
- ...toConfig(proxy),
- createdAt: proxy.createdAt
- });
+ const toAdminView = (proxy: TAgentVaultProxies) => {
+ const config = toConfig(proxy);
+ return {
+ ...toMemberView(proxy),
+ ...config,
+ trafficPolicy: toTrafficPolicyView(config.trafficPolicy),
+ createdAt: proxy.createdAt
+ };
+ };
const $authorize = async (
{ projectId, ctx }: TAgentVaultProxyScoped,
@@ -356,7 +362,7 @@ export const agentVaultProxyServiceFactory = ({
{
projectId,
name,
- trafficPolicy: settings.trafficPolicy ?? AgentVaultTrafficPolicy.AnyHost,
+ trafficPolicy: toStoredTrafficPolicy(settings.trafficPolicy ?? AgentVaultTrafficPolicy.AnyHost),
allowedHosts: settings.allowedHosts ?? null,
pollInterval: settings.pollInterval ?? 60,
tokenVersion: 1,
@@ -428,7 +434,11 @@ export const agentVaultProxyServiceFactory = ({
}
try {
- const updated = await agentVaultProxyDAL.updateById(proxy.id, { name, ...settings });
+ const updated = await agentVaultProxyDAL.updateById(proxy.id, {
+ name,
+ ...settings,
+ ...(settings.trafficPolicy && { trafficPolicy: toStoredTrafficPolicy(settings.trafficPolicy) })
+ });
return toAdminView(updated);
} catch (err) {
if (isUniqueViolation(err)) throw new BadRequestError({ message: `A proxy named '${name}' already exists` });
diff --git a/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-types.ts b/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-types.ts
index 33cbe14a9c..62c1887cfa 100644
--- a/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-types.ts
+++ b/backend/src/ee/services/agent-vault-proxy/agent-vault-proxy-types.ts
@@ -9,7 +9,8 @@ import {
export type TAgentVaultProxyScoped = { projectId: string; ctx: TGenericPermission };
export type TAgentVaultProxyConfig = {
- trafficPolicy: AgentVaultTrafficPolicy;
+ // The name proxies understand; the admin API calls bundle-hosts service-hosts.
+ trafficPolicy: AgentVaultTrafficPolicy.AnyHost | AgentVaultTrafficPolicy.BundleHosts;
allowedHosts: string | null;
pollInterval: number;
};
diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-dal.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-dal.ts
index c8b368ccfc..a980ab09e4 100644
--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-dal.ts
+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-dal.ts
@@ -10,9 +10,9 @@ import { TAgentVaultSessionInlineServiceSummaryRow } from "./agent-vault-session
export type TAgentVaultSessionInlineServiceDALFactory = ReturnType<typeof agentVaultSessionInlineServiceDALFactory>;
-const DELETE_SECRETS_BATCH_SIZE = 1000;
+export const DELETE_SECRETS_BATCH_SIZE = 1000;
-const SUMMARY_COLUMNS: string[] = [
+const SUMMARY_COLUMNS = [
"id",
"sessionId",
"position",
@@ -28,7 +28,7 @@ const SUMMARY_COLUMNS: string[] = [
"substitutions",
"createdAt",
"updatedAt"
-];
+] as const satisfies readonly (keyof TAgentVaultSessionInlineServiceSummaryRow)[];
export const agentVaultSessionInlineServiceDALFactory = (db: TDbClient) => {
const orm = ormify(db, TableName.AgentVaultSessionInlineService);
diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.test.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.test.ts
index 9902acb04f..4e0105a6fc 100644
--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.test.ts
+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.test.ts
@@ -143,9 +143,28 @@ describe("prepareInlineServices", () => {
test("refuses two inline services covering the same pattern but allows an exact host beside a wildcard", () => {
expect(() =>
prepareInlineServices([httpBearer({ name: "first" }), httpBearer({ hostPattern: "API.example.com" })])
- ).toThrow("Services 'first' and 'API.example.com' both cover api.example.com:443. Remove it from one of them.");
+ ).toThrow(
+ "The service 'first' and the service at index 1 both cover api.example.com:443. Remove it from one of them."
+ );
expect(() => prepareInlineServices([httpBearer({ hostPattern: "*.example.com" }), httpBearer()])).not.toThrow();
});
+
+ test("refuses a service sent without a name whose first host is another service's name", () => {
+ expect(() =>
+ prepareInlineServices([
+ httpBearer({ name: "localhost", hostPattern: "api.example.com" }),
+ httpBearer({ hostPattern: "localhost" })
+ ])
+ ).toThrow(
+ "The service 'localhost' and the service at index 1 would both be called 'localhost', since a service sent without a name goes by its first host. Give one of them a different name."
+ );
+ });
+
+ test("refuses a basic credential with neither half", () => {
+ expect(() => prepareInlineServices([httpBearer({ credential: { type: AgentVaultCredentialType.Basic } })])).toThrow(
+ "Service at index 0: A basic credential needs a username, a password, or both"
+ );
+ });
});
describe("assertNoAccessBundleConflicts", () => {
@@ -154,7 +173,18 @@ describe("assertNoAccessBundleConflicts", () => {
test("refuses an inline service covering a pattern the bundle already covers", () => {
const prepared = prepareInlineServices([httpBearer({ hostPattern: "uploads.github.com,api.github.com" })]);
expect(() => assertNoAccessBundleConflicts(prepared, bundle)).toThrow(
- "Service 'uploads.github.com' covers api.github.com:443, which 'github' in the access bundle 'prod' already covers. Remove it from 'uploads.github.com'."
+ "The service at index 0 covers api.github.com:443, which 'github' in the access bundle 'prod' already covers. Remove it from the service at index 0."
+ );
+ });
+
+ test("refuses an inline service called the same as one of the bundle's", () => {
+ const prepared = prepareInlineServices([httpBearer({ name: "github", hostPattern: "github.example.com" })]);
+ expect(() => assertNoAccessBundleConflicts(prepared, bundle)).toThrow(
+ "The service 'github' has the same name as a service in the access bundle 'prod'. Give it a different name."
+ );
+ const unnamed = prepareInlineServices([httpBearer({ hostPattern: "github" })]);
+ expect(() => assertNoAccessBundleConflicts(unnamed, bundle)).toThrow(
+ "The service at index 0 goes by its first host, 'github', which is the name of a service in the access bundle 'prod'. Give it a name."
);
});
@@ -170,10 +200,29 @@ describe("inline service reads", () => {
"api.example.com"
);
expect(inlineServiceDisplayName({ name: "openai", hostPattern: "api.openai.com" })).toBe("openai");
+ expect(inlineServiceDisplayName({ name: null, hostPattern: "api.example.com:443, b.example.com" })).toBe(
+ "api.example.com"
+ );
+ expect(inlineServiceDisplayName({ name: null, hostPattern: "api.example.com:8443" })).toBe("api.example.com:8443");
});
- test("the summary carries no secret", () => {
- const summary = toInlineServiceSummary(storedRow({ encryptedSecrets: Buffer.from("sealed") }));
+ test("the summary names a service sent without a name by its first host", () => {
+ expect(toInlineServiceSummary(storedRow()).name).toBe("api.example.com");
+ expect(toInlineServiceSummary(storedRow({ name: "example" })).name).toBe("example");
+ });
+
+ test("the summary carries no secret, nor anything else stored beside the credential", () => {
+ const summary = toInlineServiceSummary(
+ storedRow({
+ encryptedSecrets: Buffer.from("sealed"),
+ credentialConfig: {
+ type: AgentVaultCredentialType.Bearer,
+ headerName: "Authorization",
+ headerPrefix: "Bearer",
+ source: AgentVaultCredentialType.OAuth
+ }
+ })
+ );
expect(summary).not.toHaveProperty("encryptedSecrets");
expect(summary.credential).toEqual({
type: AgentVaultCredentialType.Bearer,
@@ -232,5 +281,64 @@ describe("toResolvedInlineService", () => {
substitutions: []
})
).toBeNull();
+ expect(
+ toResolvedInlineService(
+ storedRow({ substitutions: [{ placeholder: "ACME_KEY", surfaces: [AgentVaultSubstitutionSurface.Header] }] }),
+ { credential: { value: "token" }, customHeaders: [], substitutions: [] }
+ )
+ ).toBeNull();
+ });
+
+ test("leaves out a service whose sealed credential is the wrong kind", () => {
+ expect(
+ toResolvedInlineService(storedRow(), {
+ credential: { username: "user", password: "pass" },
+ customHeaders: [],
+ substitutions: []
+ })
+ ).toBeNull();
+ expect(
+ toResolvedInlineService(
+ storedRow({
+ credentialType: AgentVaultCredentialType.Basic,
+ credentialConfig: { type: AgentVaultCredentialType.Basic }
+ }),
+ { credential: { value: "token" }, customHeaders: [], substitutions: [] }
+ )
+ ).toBeNull();
+ });
+
+ test("sends a basic credential's username and password", () => {
+ expect(
+ toResolvedInlineService(
+ storedRow({
+ credentialType: AgentVaultCredentialType.Basic,
+ credentialConfig: { type: AgentVaultCredentialType.Basic }
+ }),
+ { credential: { username: "user", password: "pass" }, customHeaders: [], substitutions: [] }
+ )?.credential
+ ).toEqual({ type: AgentVaultCredentialType.Basic, username: "user", password: "pass" });
+ });
+
+ // An OAuth source would make the proxy try to refresh a token it was sent as is.
+ test("sends only the bearer fields, whatever else is stored beside them", () => {
+ expect(
+ toResolvedInlineService(
+ storedRow({
+ credentialConfig: {
+ type: AgentVaultCredentialType.Bearer,
+ headerName: "Authorization",
+ headerPrefix: "Bearer",
+ source: AgentVaultCredentialType.OAuth
+ }
+ }),
+ { credential: { value: "token" }, customHeaders: [], substitutions: [] }
+ )?.credential
+ ).toEqual({
+ type: AgentVaultCredentialType.Bearer,
+ headerName: "Authorization",
+ headerPrefix: "Bearer",
+ value: "token"
+ });
});
});
diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.ts
index 6fc0629a44..49cba819db 100644
--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.ts
+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-inline-service-fns.ts
@@ -54,9 +54,10 @@ export type TPreparedInlineService = {
secrets: TInlineServiceSecrets | null;
};
-// What an inline service is called wherever a name is shown: its own, or its first host when it was sent without one.
+// What an inline service is called wherever a name is shown: its own, or its first host when it was sent without one,
+// without the default port, the way every screen shows a host.
export const inlineServiceDisplayName = ({ name, hostPattern }: { name?: string | null; hostPattern: string }) =>
- name || hostPattern.split(",")[0].trim();
+ name || hostPattern.split(",")[0].trim().replace(/:443$/, "");
const toInlineCredential = (
credential: Exclude<TAgentVaultInlineServiceInput["credential"], { type: AgentVaultCredentialType.OAuth }>
@@ -149,9 +150,13 @@ const prepareInlineService = (input: TAgentVaultInlineServiceInput, position: nu
};
};
+// How mint errors point at a service: by the name it was sent with, or by its place in the list.
+const inlineServiceLabel = (service: Pick<TPreparedInlineService, "name" | "position">) =>
+ service.name ? `'${service.name}'` : `at index ${service.position}`;
+
const toConflictCandidate = (service: TPreparedInlineService): TConflictCandidate => ({
id: String(service.position),
- name: inlineServiceDisplayName(service),
+ name: inlineServiceLabel(service),
hostPattern: service.hostPattern
});
@@ -166,7 +171,7 @@ export const prepareInlineServices = (inputs: TAgentVaultInlineServiceInput[]):
return prepareInlineService(input, position);
} catch (error) {
if (error instanceof BadRequestError) {
- const label = input.name ? `Service '${input.name}'` : `Service at index ${position}`;
+ const label = `Service ${inlineServiceLabel({ name: input.name ?? null, position })}`;
throw new BadRequestError({ message: `${label}: ${error.message}` });
}
throw error;
@@ -177,28 +182,50 @@ export const prepareInlineServices = (inputs: TAgentVaultInlineServiceInput[]):
const [conflict] = findHostPatternConflicts(service.hostPattern, prepared.slice(0, index).map(toConflictCandidate));
if (conflict) {
throw new BadRequestError({
- message: `Services '${conflict.serviceName}' and '${inlineServiceDisplayName(service)}' both cover ${conflict.patterns.join(", ")}. Remove it from one of them.`
+ message: `The service ${conflict.serviceName} and the service ${inlineServiceLabel(service)} both cover ${conflict.patterns.join(", ")}. Remove it from one of them.`
+ });
+ }
+ });
+
+ // An unnamed service goes by its first host in session logs and proxy errors, so it can't share that name.
+ const byDisplayName = new Map<string, TPreparedInlineService>();
+ prepared.forEach((service) => {
+ const displayName = inlineServiceDisplayName(service);
+ const earlier = byDisplayName.get(displayName);
+ if (earlier) {
+ throw new BadRequestError({
+ message: `The service ${inlineServiceLabel(earlier)} and the service ${inlineServiceLabel(service)} would both be called '${displayName}', since a service sent without a name goes by its first host. Give one of them a different name.`
});
}
+ byDisplayName.set(displayName, service);
});
return prepared;
};
/**
- * A mint that also names an access bundle can't send a service covering a pattern one of the bundle's services covers.
- * Only checked at mint: the bundle can change afterwards, and resolve puts the bundle's services first, so a pattern a
- * later bundle edit shares with an inline service goes to the bundle's.
+ * A mint that also names an access bundle can't send a service covering a pattern one of the bundle's services covers,
+ * or one called the same as a bundle's service. Only checked at mint: the bundle can change afterwards, and resolve puts
+ * the bundle's services first, so a pattern a later bundle edit shares with an inline service goes to the bundle's.
*/
export const assertNoAccessBundleConflicts = (
prepared: TPreparedInlineService[],
accessBundle: { name: string; services: TConflictCandidate[] }
) => {
prepared.forEach((service) => {
+ const label = inlineServiceLabel(service);
const [conflict] = findHostPatternConflicts(service.hostPattern, accessBundle.services);
if (conflict) {
throw new BadRequestError({
- message: `Service '${inlineServiceDisplayName(service)}' covers ${conflict.patterns.join(", ")}, which '${conflict.serviceName}' in the access bundle '${accessBundle.name}' already covers. Remove it from '${inlineServiceDisplayName(service)}'.`
+ message: `The service ${label} covers ${conflict.patterns.join(", ")}, which '${conflict.serviceName}' in the access bundle '${accessBundle.name}' already covers. Remove it from the service ${label}.`
+ });
+ }
+ const displayName = inlineServiceDisplayName(service);
+ if (accessBundle.services.some((bundleService) => bundleService.name === displayName)) {
+ throw new BadRequestError({
+ message: service.name
+ ? `The service ${label} has the same name as a service in the access bundle '${accessBundle.name}'. Give it a different name.`
+ : `The service ${label} goes by its first host, '${displayName}', which is the name of a service in the access bundle '${accessBundle.name}'. Give it a name.`
});
}
});
@@ -206,6 +233,11 @@ export const assertNoAccessBundleConflicts = (
export type TAgentVaultSessionInlineServiceSummaryRow = Omit<TAgentVaultSessionInlineServices, "encryptedSecrets">;
+const toInlineCredentialSummary = (config: TInlineCredentialConfig): TInlineCredentialConfig =>
+ config.type === AgentVaultCredentialType.Bearer
+ ? { type: config.type, headerName: config.headerName, headerPrefix: config.headerPrefix }
+ : { type: config.type };
+
// Built by hand rather than spread, so the sealed column stays off the wire even if a response schema is loosened.
export const toInlineServiceSummary = (
row: TAgentVaultSessionInlineServiceSummaryRow
@@ -213,14 +245,14 @@ export const toInlineServiceSummary = (
const config = (row.config ?? {}) as TAgentVaultServiceConfig;
return {
id: row.id,
- name: row.name ?? null,
+ name: inlineServiceDisplayName(row),
type: row.type as AgentVaultServiceType,
serverUrl: config.serverUrl ?? null,
transport: config.transport ?? null,
hostPattern: row.hostPattern,
allowedMethods: (row.allowedMethods ?? null) as AgentVaultHttpMethod[] | null,
allowedPathPrefixes: row.allowedPathPrefixes ?? null,
- credential: row.credentialConfig as TInlineCredentialConfig,
+ credential: toInlineCredentialSummary(row.credentialConfig as TInlineCredentialConfig),
customHeaders: row.customHeaders as TInlineCustomHeader[],
substitutions: row.substitutions as TInlineSubstitution[]
};
@@ -249,13 +281,22 @@ export const toResolvedInlineService = (
secrets?.credential &&
"value" in secrets.credential
) {
- credential = { ...credentialConfig, value: secrets.credential.value };
+ credential = {
+ type: AgentVaultCredentialType.Bearer,
+ headerName: credentialConfig.headerName,
+ headerPrefix: credentialConfig.headerPrefix,
+ value: secrets.credential.value
+ };
} else if (
credentialConfig.type === AgentVaultCredentialType.Basic &&
secrets?.credential &&
"username" in secrets.credential
) {
- credential = { type: AgentVaultCredentialType.Basic, ...secrets.credential };
+ credential = {
+ type: AgentVaultCredentialType.Basic,
+ username: secrets.credential.username,
+ password: secrets.credential.password
+ };
} else {
return null;
}
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.ts
index 491c083632..caa6413596 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
@@ -107,7 +107,9 @@ export const agentVaultSessionServiceFactory = ({
);
const bySession = new Map<string, TAgentVaultInlineServiceSummary[]>();
rows.forEach((row) => {
- bySession.set(row.sessionId, [...(bySession.get(row.sessionId) ?? []), toInlineServiceSummary(row)]);
+ const summaries = bySession.get(row.sessionId);
+ if (summaries) summaries.push(toInlineServiceSummary(row));
+ else bySession.set(row.sessionId, [toInlineServiceSummary(row)]);
});
return sessions.map((session) => ({ ...session, services: bySession.get(session.id) ?? [] }));
};
diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts
index 00fa8006e0..73117ef75f 100644
--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts
+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts
@@ -47,7 +47,8 @@ export type TAgentVaultInlineServiceInput = {
/** An inline service as every read returns it: everything but its secrets. */
export type TAgentVaultInlineServiceSummary = {
id: string;
- name: string | null;
+ // The name it was sent with, or its first host when it was sent without one.
+ name: string;
type: AgentVaultServiceType;
serverUrl: string | null;
transport: AgentVaultMcpTransport | null;
diff --git a/backend/src/ee/services/agent-vault/AGENTS.md b/backend/src/ee/services/agent-vault/AGENTS.md
index fd211ad521..2d6beb6c8e 100644
--- a/backend/src/ee/services/agent-vault/AGENTS.md
+++ b/backend/src/ee/services/agent-vault/AGENTS.md
@@ -45,9 +45,9 @@ and `packages/agentvault/` in the CLI repo. Frontend: `frontend/src/pages/agent-
by link, and that route is where the `agent_vault_identities` meter moves for them. Only org creation seeds
the creator.
- The traffic policy defaults to any-host (formerly Allow), in the DB default, the service and the dialog.
- Deliberate: the product brokers credentials, it is not an egress firewall, and under bundle-hosts the
+ Deliberate: the product brokers credentials, it is not an egress firewall, and under service-hosts the
quickstart's agent could reach neither Anthropic nor npm until a bypass list exists. Settled with the
- product owner; bundle-hosts is documented as the hardening step.
+ product owner; service-hosts is documented as the hardening step.
- Wherever code branches on `ProjectType.PAM`, add the Agent Vault arm: `AgentVaultIdentities` metering emits,
the admin-or-member predefined roles filter, `AuditLogStreamProduct`, `grantAgentVaultAccess` on the org
invite. See the root `AGENTS.md`.
@@ -207,7 +207,7 @@ tells them apart from a bundle's. They are rows of `agent_vault_session_inline_s
alone: nothing edits them, no bundle or other session reads them, and only resolve opens their secrets.
- **Admin only, at mint and on every resolve.** Whoever starts the session decides which hosts it reaches and with
- which credentials, an admin's call for a bundle's services too. It also keeps `bundle-hosts` meaningful: a proxy lets
+ which credentials, an admin's call for a bundle's services too. It also keeps `service-hosts` meaningful: a proxy lets
through any host a session's services cover, so a member's inline service would open any host they chose. Resolve
sends inline services only while the session's owner (the identity, on an on-behalf-of session) is a live admin, so a
demotion keeps the bundle and drops the inline services until they are an admin again, the way a lost grant drops a
@@ -220,9 +220,11 @@ alone: nothing edits them, no bundle or other session reads them, and only resol
- **No member-provided fields and no OAuth.** Every value arrives with the mint, and an OAuth service needs a sign-in in
the UI and a refresh that writes the service row. The schema accepts both, hidden, so `prepareInlineServices` refuses
them by name, as a bundle service's create refuses fields its type doesn't take.
-- **The name is optional.** Wherever a name is shown (resolve, so the proxy's messages and session logs, the audit log,
- the Sessions page), an unnamed service goes by its first host (`inlineServiceDisplayName`, mirrored in the frontend).
- Resolve sends `accessBundleName: null` for an inline service.
+- **The name is optional.** An unnamed service goes by its first host (`inlineServiceDisplayName`), worked out on the
+ server only: resolve (so the proxy's messages and session logs), the audit log and the session responses all send
+ that name, so `name` is never null on the wire and the frontend shows it as is. Mint refuses a name, given or
+ fallen back to, that another inline service or a service in the session's bundle already goes by, so a name in a
+ session log always points at one service. Resolve sends `accessBundleName: null` for an inline service.
- **The host rule of one bundle's services applies across the session**: two inline services covering the same pattern
are refused, and so is one covering a pattern the session's bundle covers. Mint checks it without the bundle lock, so
a later bundle edit can still create the overlap; resolve puts the bundle's services first, and the Go matcher breaks
@@ -258,6 +260,12 @@ alone: nothing edits them, no bundle or other session reads them, and only resol
saved one would report a live proxy as unreachable until then. Gateway v2 does the same.
- The proxy token is non-expiring and revoked by bumping `tokenVersion`, which the auth plugin checks on every
proxy request. Revoke Access goes through the shared resource-auth revoke; rotating brings a revoked proxy back.
+- The traffic policy that only lets through hosts a session's services cover is `service-hosts` in the admin API
+ and the UI, and its old name `bundle-hosts` is still accepted as input. The row still stores `bundle-hosts`, and
+ bootstrap and heartbeat still send it: a released CLI blocks only under that exact value and lets every host
+ through under one it doesn't know, and an older pod reading a stored `service-hosts` would pass it straight on.
+ `toStoredTrafficPolicy` and `toTrafficPolicyView` do the mapping. Retiring the old name takes a CLI release that
+ accepts both, time for older CLIs to age out, then a migration of the rows and a switch of what proxies are sent.
- Resolve is not audited: once per poll per session would swamp the audit table. Bootstrap is not audited
either, since a proxy run as a sidecar starts once per agent run.
diff --git a/backend/src/ee/services/agent-vault/agent-vault-enums.ts b/backend/src/ee/services/agent-vault/agent-vault-enums.ts
index 2a3f84902c..7da46e3028 100644
--- a/backend/src/ee/services/agent-vault/agent-vault-enums.ts
+++ b/backend/src/ee/services/agent-vault/agent-vault-enums.ts
@@ -56,9 +56,20 @@ export enum AgentVaultSubstitutionSurface {
export enum AgentVaultTrafficPolicy {
AnyHost = "any-host",
+ ServiceHosts = "service-hosts",
+ // The old name of service-hosts. Still accepted, still what is stored, and still what proxies are sent: a released
+ // CLI only blocks under this value and lets every host through under one it doesn't know.
BundleHosts = "bundle-hosts"
}
+// What a proxy's traffic policy is stored as, and sent to proxies as, until every CLI in use knows service-hosts.
+export const toStoredTrafficPolicy = (policy: AgentVaultTrafficPolicy) =>
+ policy === AgentVaultTrafficPolicy.ServiceHosts ? AgentVaultTrafficPolicy.BundleHosts : policy;
+
+// What the admin API and the UI call it.
+export const toTrafficPolicyView = (policy: AgentVaultTrafficPolicy) =>
+ policy === AgentVaultTrafficPolicy.BundleHosts ? AgentVaultTrafficPolicy.ServiceHosts : policy;
+
export enum AgentVaultSessionStatus {
Active = "active",
Revoked = "revoked",
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index acd4090cc1..b2d19e7de9 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -6915,7 +6915,8 @@ interface AgentVaultSessionMintEvent {
// Set when an admin sent services with the session. Never their values.
services?: {
serviceId: string;
- name: string | null;
+ // The name it was sent with, or its first host when it was sent without one.
+ name: string;
serviceType: string;
serverUrl?: string;
hostPattern: string;
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index adc852a136..a51d63dbe1 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -4893,9 +4893,13 @@ export const AGENT_VAULT = {
"The SHA-256 fingerprint of the proxy's certificate authority. Pin this if you want to verify the proxy an agent connects to.",
rootCaExpiresAt: "When the proxy's certificate authority expires.",
trafficPolicy:
- "Which hosts an agent may reach through this proxy. `any-host` lets every request out; `bundle-hosts` allows only hosts an access bundle covers, plus anything in `allowedHosts`, and refuses the rest with a 403.",
+ "Which hosts an agent may reach through this proxy. `any-host` lets every request out; `service-hosts` allows only hosts that the session's services cover, from its access bundle or sent with the session, plus anything in `allowedHosts`, and refuses the rest with a 403. `bundle-hosts` is the old name of `service-hosts` and is still accepted.",
+ trafficPolicyProxy:
+ "Which hosts the proxy lets agents reach: `any-host` for every host, or `bundle-hosts` for only the hosts the session's services cover plus `allowedHosts`.",
+ trafficPolicyRead:
+ "Which hosts an agent may reach through this proxy. `any-host` lets every request out; `service-hosts` allows only hosts that the session's services cover, from its access bundle or sent with the session, plus anything in `allowedHosts`, and refuses the rest with a 403.",
allowedHosts:
- "Hosts that stay reachable under the `bundle-hosts` traffic policy even though no access bundle covers them. Still intercepted, and given no credential.",
+ "Hosts that stay reachable under the `service-hosts` traffic policy even though none of the session's services cover them. Still intercepted, and given no credential.",
pollInterval: "How often, in seconds, the proxy refreshes its sessions and settings. Between 10 and 300.",
sessionToken: "The session an agent is running with. A selector, not a second credential.",
createdAt: "When the proxy was registered."
@@ -4953,9 +4957,9 @@ export const AGENT_VAULT = {
accessBundles:
"The access bundle this session carries, by name. A list that accepts one name at most. Leave it out to start a session with services of its own only.",
inlineServices:
- "Services this session carries itself, alongside its access bundle's or without one. Agent Vault admins only, up to 20. Each takes the same fields as a service in an access bundle, with three differences: the name is optional, every value is sent exactly as given because variables aren't available, and no field can be left to members. They belong to this session only and can't be edited. Their credentials, custom header values and substitution values are deleted once the session is revoked or expires.",
+ "Services this session carries itself, alongside its access bundle's or without one. Agent Vault admins only, up to 20. Each takes the same fields as a service in an access bundle, with three differences: the name is optional, every value is sent exactly as given because variables aren't available, and no field can be left to members. They belong to this session only and can't be edited. Their credentials, custom header values and substitution values are deleted when the session is revoked, or within an hour after it expires.",
inlineServiceName:
- "A name for the service, shown in session logs and in the proxy's error messages. Lowercase letters, numbers and hyphens, unique within the session. Leave it out to show the service's host instead.",
+ "A name for the service, shown in session logs and in the proxy's error messages. Lowercase letters, numbers and hyphens. Leave it out and the service goes by its first host. Either way, it can't match the name of another service in the session or in its access bundle.",
inlineServiceValue:
"The secret, sent exactly as given. Services sent with a session can't use variables, so it can't wrap text in double braces. Never returned.",
inlineServiceUsername:
@@ -4975,7 +4979,8 @@ export const AGENT_VAULT = {
inlineServicesRead:
"The services sent with this session when it was created, without their secrets. Its access bundle's services aren't listed here. Empty when the session carries only an access bundle.",
inlineServiceId: "The ID of the service sent with this session.",
- inlineServiceNameRead: "The name the service was sent with, or null if it was sent without one.",
+ inlineServiceNameRead:
+ "The name the service was sent with, or its first host if it was sent without one. Shown in session logs and in the proxy's error messages.",
ttl: "How long the session lasts: a duration such as 30m, 8h or 7d (at least 1m), or never. Defaults to 7d, or to 1h for a session started on behalf of a user.",
label:
"A short description of what the session is for, such as `nightly deploy` or `support ticket triage`. Up to 128 characters, without line breaks, tabs, or invisible characters. Shown wherever the session is listed.",
diff --git a/docs/documentation/platform/agent-vault/guides/daytona.mdx b/docs/documentation/platform/agent-vault/guides/daytona.mdx
index 0dbe2c9c7e..1b9319df04 100644
--- a/docs/documentation/platform/agent-vault/guides/daytona.mdx
+++ b/docs/documentation/platform/agent-vault/guides/daytona.mdx
@@ -1092,7 +1092,7 @@ To check which requests the agent made, [view the session's logs](/documentation
### Network access from the agent's sandbox
-The agent's sandbox can only connect to the proxy's address on the network between the two sandboxes. With the **Access bundle hosts only** traffic policy, the agent can reach two kinds of hosts through the proxy: the hosts of the services in the session's access bundle, and the proxy's exceptions.
+The agent's sandbox can only connect to the proxy's address on the network between the two sandboxes. With the **Service hosts only** traffic policy, the agent can reach two kinds of hosts through the proxy: the hosts of the services in the session's access bundle, and the proxy's exceptions.
### Compromised sandboxes
diff --git a/docs/documentation/platform/agent-vault/guides/docker.mdx b/docs/documentation/platform/agent-vault/guides/docker.mdx
index 2995efba42..8e69da7ea7 100644
--- a/docs/documentation/platform/agent-vault/guides/docker.mdx
+++ b/docs/documentation/platform/agent-vault/guides/docker.mdx
@@ -213,7 +213,7 @@ To check which requests the agent made, [set up session logs](/documentation/pla
### Network access from the agent's container
-The agent's container can't reach the internet. It can't look up hostnames on the internet either, because on an internal network, Docker only answers DNS lookups for the names of containers. With the **Access bundle hosts only** traffic policy, the agent can reach two kinds of hosts through the proxy: the hosts of the services in the session's access bundle, and the proxy's exceptions.
+The agent's container can't reach the internet. It can't look up hostnames on the internet either, because on an internal network, Docker only answers DNS lookups for the names of containers. With the **Service hosts only** traffic policy, the agent can reach two kinds of hosts through the proxy: the hosts of the services in the session's access bundle, and the proxy's exceptions.
The agent can still connect to services on the Docker host that listen on all of the host's addresses, such as `0.0.0.0`, through the gateway address of the run's network. To keep the agent away from a service on the host, have the service listen only on `127.0.0.1`, or block traffic from Docker's networks to the host with a firewall rule.
diff --git a/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx b/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx
index 85ff35a252..7c00922a4c 100644
--- a/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx
+++ b/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx
@@ -133,7 +133,7 @@ Next, create a [proxy](/documentation/platform/agent-vault/proxies) on the Agent
Give the proxy a **Name**.
<Note>
- Under the default [traffic policy](/documentation/platform/agent-vault/proxies#traffic-policy), **Any host**, the proxy forwards requests to any host the Agent Vault machine can reach, including internal systems on your private network. If Hermes shouldn't reach those systems, expand **Advanced Options** and select **Access bundle hosts only**. Then list any other hosts Hermes needs, such as package registries, in **Exceptions**.
+ Under the default [traffic policy](/documentation/platform/agent-vault/proxies#traffic-policy), **Any host**, the proxy forwards requests to any host the Agent Vault machine can reach, including internal systems on your private network. If Hermes shouldn't reach those systems, expand **Advanced Options** and select **Service hosts only**. Then list any other hosts Hermes needs, such as package registries, in **Exceptions**.
</Note>
</Step>
<Step>
diff --git a/docs/documentation/platform/agent-vault/guides/modal.mdx b/docs/documentation/platform/agent-vault/guides/modal.mdx
index b46588c854..c92563f7d5 100644
--- a/docs/documentation/platform/agent-vault/guides/modal.mdx
+++ b/docs/documentation/platform/agent-vault/guides/modal.mdx
@@ -61,7 +61,7 @@ Every sidecar starts its proxy from the same proxy token, so you create the prox
In Agent Vault, go to **Proxies** and select **Create Proxy**.
</Step>
<Step>
- Enter a **Name**, such as `modal-sandboxes`, and expand **Advanced Options**. Under **Traffic Policy**, choose **Access bundle hosts only**, and add any hosts the agent needs without a credential to **Exceptions**, such as `registry.npmjs.org`.
+ Enter a **Name**, such as `modal-sandboxes`, and expand **Advanced Options**. Under **Traffic Policy**, choose **Service hosts only**, and add any hosts the agent needs without a credential to **Exceptions**, such as `registry.npmjs.org`.
The sidecar can reach the internet, so with **Any host**, the agent could send requests through the proxy to any host. Learn more about the [traffic policy](/documentation/platform/agent-vault/proxies#traffic-policy).
</Step>
@@ -685,7 +685,7 @@ To check which requests the agent made, [set up session logs](/documentation/pla
The agent's container can't connect to the internet directly, but it has two kinds of network access:
- **DNS:** Modal answers DNS lookups in a sandbox even with an empty allowlist, so the agent can look up hostnames
-- **Hosts through the proxy:** with **Access bundle hosts only**, the agent can reach the hosts that services in the session's access bundle cover, and the proxy's exceptions
+- **Hosts through the proxy:** with **Service hosts only**, the agent can reach the hosts that services in the session's access bundle cover, and the proxy's exceptions
### Compromised sandboxes
diff --git a/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx b/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx
index e4896b2963..9bc4cf8ed5 100644
--- a/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx
+++ b/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx
@@ -127,7 +127,7 @@ Next, create a [proxy](/documentation/platform/agent-vault/proxies) on the Agent
Give the proxy a **Name**.
<Note>
- Under the default [traffic policy](/documentation/platform/agent-vault/proxies#traffic-policy), **Any host**, the proxy forwards requests to any host the Agent Vault machine can reach, including internal systems on your private network. If OpenClaw shouldn't reach those systems, expand **Advanced Options** and select **Access bundle hosts only**. Then list any other hosts OpenClaw needs, such as package registries, in **Exceptions**.
+ Under the default [traffic policy](/documentation/platform/agent-vault/proxies#traffic-policy), **Any host**, the proxy forwards requests to any host the Agent Vault machine can reach, including internal systems on your private network. If OpenClaw shouldn't reach those systems, expand **Advanced Options** and select **Service hosts only**. Then list any other hosts OpenClaw needs, such as package registries, in **Exceptions**.
</Note>
</Step>
<Step>
diff --git a/docs/documentation/platform/agent-vault/inline-services.mdx b/docs/documentation/platform/agent-vault/inline-services.mdx
index 13638d202b..d7f39b800e 100644
--- a/docs/documentation/platform/agent-vault/inline-services.mdx
+++ b/docs/documentation/platform/agent-vault/inline-services.mdx
@@ -1,11 +1,11 @@
---
title: "Inline services"
-description: "Services that an Agent Vault admin sends in the request that creates a session, for that session alone."
+description: "Services and credentials that you send when you create a session, so nothing needs to be set up in Agent Vault in advance."
---
An inline service is a [service](/documentation/platform/agent-vault/services) that you send in the request that creates a [session](/documentation/platform/agent-vault/sessions), instead of adding the service to an [access bundle](/documentation/platform/agent-vault/access-bundles). Only that session can use the inline service. A session can have inline services on their own, or together with one access bundle.
-Use inline services when an agent needs a credential that exists for only one run, such as a token that your job runner creates for each job. You can also use them to give one session access to an API that isn't in its access bundle. The other sessions that use the access bundle don't get access to the API.
+Use inline services when the code that creates sessions, such as an agent orchestrator or a job runner, already knows which APIs an agent needs and holds their credentials. That code sends the services with each session, so nothing has to be set up in Agent Vault in advance, and a credential that exists for only one run is deleted when the session ends. You can also use inline services to give one session access to an API that isn't in its access bundle, without giving the API to the other sessions that use the bundle.
## Prerequisites
@@ -38,13 +38,13 @@ curl -X POST https://app.infisical.com/api/v1/agent-vault/sessions \
An inline service has the same fields as an [HTTP API](/documentation/platform/agent-vault/http-apis) or an [MCP server](/documentation/platform/agent-vault/mcp-servers) in an access bundle, with these differences:
-- `name` is optional (without a name, the **Sessions** page and the [session logs](/documentation/platform/agent-vault/session-logs) show the service's first host)
+- `name` is optional (without a name, the service goes by its first host on the **Sessions** page and in the [session logs](/documentation/platform/agent-vault/session-logs))
- Credentials, custom header values, and substitution values can't use [variables](/documentation/platform/agent-vault/variables), so they can't contain text in double braces, such as `{{GITHUB_TOKEN}}`
- An MCP server can't use [OAuth](/documentation/platform/agent-vault/mcp-servers#oauth)
- A credential can't use [member-provided values](/documentation/platform/agent-vault/http-apis#member-provided-values)
- You can't change an inline service after you create the session
-A session can have up to 20 inline services. The reference for [the endpoint that creates a session](/api-reference/endpoints/agent-vault-sessions/create) lists every field and its limits.
+A session can have up to 20 inline services, and no two of its services can have the same name, including the services in its access bundle. A service sent without a name counts as its first host. The reference for [the endpoint that creates a session](/api-reference/endpoints/agent-vault-sessions/create) lists every field and its limits.
Start the agent with the session token from the response, as [Step 4 of Create sessions with the API](/documentation/platform/agent-vault/sessions-api#step-4-start-the-agent-with-the-session-token) describes. When the agent finishes, [revoke the session](/documentation/platform/agent-vault/sessions-api#step-5-revoke-the-session).
@@ -65,7 +65,7 @@ When you create the session, Infisical compares the host patterns of the inline
To see a session's inline services, go to **Sessions** in Agent Vault, select **View Session Logs** on the session's row, and look under **Inline Services**.
-[The endpoint that reads a session](/api-reference/endpoints/agent-vault-sessions/get) and [the endpoint that lists sessions](/api-reference/endpoints/agent-vault-sessions/list) return the inline services in `services`, and the [audit event](/documentation/platform/agent-vault/sessions#audit-trail) for creating the session lists them too. Neither the API responses nor the audit event includes the inline services' credentials, custom header values, or substitution values.
+[The endpoint that reads a session](/api-reference/endpoints/agent-vault-sessions/get) and [the endpoint that lists sessions](/api-reference/endpoints/agent-vault-sessions/list) return the inline services in `services`, and the [audit event](/documentation/platform/agent-vault/sessions#audit-trail) for creating the session lists them too.
## When the session ends
@@ -82,7 +82,19 @@ If you set `ttl` to `never`, revoke the session when the agent finishes, so that
<Accordion title="Creating the session fails with &quot;Only an Agent Vault admin can send services with a session&quot;">
The machine identity has the **Member** role in Agent Vault. Either give it the **Admin** role, or add the services to an access bundle and [grant the bundle](/documentation/platform/agent-vault/access-bundles#grant-access) to the machine identity.
- To change the role, go to **Access Control** > **Machine Identities** in Agent Vault, select **Change Role** in the machine identity's menu, choose **Admin** in **Product Role**, and select **Save**.
+ To give the machine identity the **Admin** role:
+
+ <Steps>
+ <Step>
+ In Agent Vault, go to **Access Control** > **Machine Identities**.
+ </Step>
+ <Step>
+ Open the machine identity's menu and select **Change Role**.
+ </Step>
+ <Step>
+ Choose **Admin** in **Product Role**, then select **Save**.
+ </Step>
+ </Steps>
</Accordion>
<Accordion title="Requests to an inline service's host stop getting credentials">
The user or machine identity that created the session no longer has the **Admin** role in Agent Vault. Give the role back, or create a new session as an admin.
diff --git a/docs/documentation/platform/agent-vault/proxies.mdx b/docs/documentation/platform/agent-vault/proxies.mdx
index 67d2ee2f80..5a7ca9d400 100644
--- a/docs/documentation/platform/agent-vault/proxies.mdx
+++ b/docs/documentation/platform/agent-vault/proxies.mdx
@@ -165,10 +165,10 @@ To change a setting, select **Edit Settings** on the proxy's menu. If the proxy
The **Traffic Policy** setting controls which hosts agents can reach through the proxy:
- **Any host** (default): the proxy forwards every request, and attaches a credential only for hosts covered by a service
-- **Access bundle hosts only**: the proxy refuses requests to hosts that no service in the session's access bundle covers, unless the host is an [exception](#exceptions) or one of the session's [inline services](/documentation/platform/agent-vault/inline-services) covers it
+- **Service hosts only**: the proxy refuses requests to hosts that none of the session's services cover, unless the host is an [exception](#exceptions) (the session's services are the ones in its access bundle and its [inline services](/documentation/platform/agent-vault/inline-services))
<Tip>
-Use **Access bundle hosts only** if the proxy can reach systems that agents shouldn't have access to, such as internal services on the same network.
+Use **Service hosts only** if the proxy can reach systems that agents shouldn't have access to, such as internal services on the same network.
</Tip>
#### Blocked requests
@@ -189,7 +189,7 @@ The proxy also returns a 403 for:
### Exceptions
-Exceptions allow your agents to access hosts that aren't covered by any service in an access bundle, even when your proxy uses **Access bundle hosts only**. Use exceptions for hosts every agent needs, such as a package registry or a documentation site.
+Exceptions allow your agents to access hosts that none of the session's services cover, even when your proxy uses **Service hosts only**. Use exceptions for hosts every agent needs, such as a package registry or a documentation site.
To add exceptions, select the policy and enter the hosts in **Exceptions** as a comma-separated list. The field doesn't appear under **Any host**, because that policy already lets every host through.
diff --git a/docs/documentation/platform/agent-vault/services.mdx b/docs/documentation/platform/agent-vault/services.mdx
index b72c100139..059f312923 100644
--- a/docs/documentation/platform/agent-vault/services.mdx
+++ b/docs/documentation/platform/agent-vault/services.mdx
@@ -5,7 +5,7 @@ description: "Anything an AI agent talks to during a session, such as an API or
A service is something your agent talks to during a [session](/documentation/platform/agent-vault/sessions), such as an API or an MCP server, that Agent Vault brokers credentials for. You store the real credential on the service, and the [proxy](/documentation/platform/agent-vault/proxies) adds it to the agent's requests to that service. The agent can authenticate to the service without ever holding the credential.
-You can configure services within an [access bundle](/documentation/platform/agent-vault/access-bundles). For example, you might create a **code-review** access bundle and add services for Slack, GitHub, and Anthropic:
+You can configure services within an [access bundle](/documentation/platform/agent-vault/access-bundles), or an admin can send them with a session as [inline services](/documentation/platform/agent-vault/inline-services) when creating it through the API. For example, you might create a **code-review** access bundle and add services for Slack, GitHub, and Anthropic:
<Frame>
<img src="/images/platform/agent-vault/access-bundle-services.png" alt="The code-review access bundle's Services table listing its GitHub, Slack, and Anthropic services with their credentials and hosts" />
diff --git a/docs/documentation/platform/agent-vault/sessions.mdx b/docs/documentation/platform/agent-vault/sessions.mdx
index 53f54d0c66..1394c55ecd 100644
--- a/docs/documentation/platform/agent-vault/sessions.mdx
+++ b/docs/documentation/platform/agent-vault/sessions.mdx
@@ -110,7 +110,7 @@ The access bundle and any inline services are chosen when you create the session
- If someone still has another grant on the bundle, such as through a group, revoking one grant doesn't affect their sessions
- If you delete an access bundle, every session scoped to it stops getting credentials (the session still lists the bundle's name, so you can see what it was)
- If you remove someone from Agent Vault, the proxy refuses every request on their sessions
-- If someone loses the **Admin** role in Agent Vault, their sessions stop getting credentials for [inline services](/documentation/platform/agent-vault/inline-services)
+- If the user or machine identity that created a session loses the **Admin** role in Agent Vault, the session stops getting credentials for its [inline services](/documentation/platform/agent-vault/inline-services)
None of these changes removes the [skills](/documentation/platform/agent-vault/skills) that the CLI already installed on the agent's host. To stop agents from using those skills, [delete the installed copies](/documentation/platform/agent-vault/skills#remove-installed-skills).
diff --git a/docs/snippets/agent-vault/SandboxAgentVaultSetup.mdx b/docs/snippets/agent-vault/SandboxAgentVaultSetup.mdx
index 31a47544e0..87b4e1bed5 100644
--- a/docs/snippets/agent-vault/SandboxAgentVaultSetup.mdx
+++ b/docs/snippets/agent-vault/SandboxAgentVaultSetup.mdx
@@ -7,10 +7,10 @@ import MachineIdentitySetup from "/snippets/agent-vault/MachineIdentitySetup.mdx
In Agent Vault, go to **Proxies** and select **Create Proxy**.
</Step>
<Step>
- Enter a **Name**, such as `sandboxes`, and expand **Advanced Options**. Under **Traffic Policy**, choose **Access bundle hosts only**. Then add any other hosts the agent needs to reach to **Exceptions** (for example, `registry.npmjs.org`).
+ Enter a **Name**, such as `sandboxes`, and expand **Advanced Options**. Under **Traffic Policy**, choose **Service hosts only**. Then add any other hosts the agent needs to reach to **Exceptions** (for example, `registry.npmjs.org`).
<Note>
- Make sure you select the **Access bundle hosts only** [traffic policy](/documentation/platform/agent-vault/proxies#traffic-policy). The proxy can reach the internet, so if you leave the traffic policy set to **Any host**, the agent can send requests through the proxy to any host.
+ Make sure you select the **Service hosts only** [traffic policy](/documentation/platform/agent-vault/proxies#traffic-policy). The proxy can reach the internet, so if you leave the traffic policy set to **Any host**, the agent can send requests through the proxy to any host.
</Note>
</Step>
<Step>
diff --git a/frontend/src/hooks/api/agentVault/enums.ts b/frontend/src/hooks/api/agentVault/enums.ts
index 2fce31e535..470a7da179 100644
--- a/frontend/src/hooks/api/agentVault/enums.ts
+++ b/frontend/src/hooks/api/agentVault/enums.ts
@@ -52,9 +52,14 @@ export enum AgentVaultMemberType {
export enum AgentVaultTrafficPolicy {
AnyHost = "any-host",
+ ServiceHosts = "service-hosts",
+ // The old name of service-hosts, which an API that predates the rename still returns.
BundleHosts = "bundle-hosts"
}
+export const isServiceHostsPolicy = (policy: AgentVaultTrafficPolicy | undefined) =>
+ policy === AgentVaultTrafficPolicy.ServiceHosts || policy === AgentVaultTrafficPolicy.BundleHosts;
+
export enum AgentVaultSessionStatus {
Active = "active",
Revoked = "revoked",
diff --git a/frontend/src/hooks/api/agentVault/types.ts b/frontend/src/hooks/api/agentVault/types.ts
index b2c4be31c9..8ec1aa9293 100644
--- a/frontend/src/hooks/api/agentVault/types.ts
+++ b/frontend/src/hooks/api/agentVault/types.ts
@@ -255,7 +255,8 @@ export type TAgentVaultSessionAccessBundle = {
/** A service an admin sent with the session itself. Its secrets are never returned. */
export type TAgentVaultSessionInlineService = {
id: string;
- name: string | null;
+ // The name it was sent with, or its first host when it was sent without one.
+ name: string;
type: AgentVaultServiceType;
serverUrl: string | null;
transport: AgentVaultMcpTransport | null;
diff --git a/frontend/src/pages/agent-vault/AgentVaultProxiesPage/AgentVaultProxiesPage.tsx b/frontend/src/pages/agent-vault/AgentVaultProxiesPage/AgentVaultProxiesPage.tsx
index fac9504f9f..532cfe8d99 100644
--- a/frontend/src/pages/agent-vault/AgentVaultProxiesPage/AgentVaultProxiesPage.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultProxiesPage/AgentVaultProxiesPage.tsx
@@ -65,7 +65,7 @@ import {
} from "@app/helpers/userTablePreferences";
import { useResetPageHelper } from "@app/hooks";
import {
- AgentVaultTrafficPolicy,
+ isServiceHostsPolicy,
useDeleteAgentVaultProxy,
useListAgentVaultProxies,
useRevokeAgentVaultProxyAccess,
@@ -90,12 +90,12 @@ const allowedHostsOf = (proxy: TAgentVaultProxy) =>
: [];
const TrafficPolicyCell = ({ proxy }: { proxy: TAgentVaultProxy }) => {
- const isBundleOnly = proxy.trafficPolicy === AgentVaultTrafficPolicy.BundleHosts;
- const allowedHosts = isBundleOnly ? allowedHostsOf(proxy) : [];
+ const isServiceHostsOnly = isServiceHostsPolicy(proxy.trafficPolicy);
+ const allowedHosts = isServiceHostsOnly ? allowedHostsOf(proxy) : [];
const cell = (
<span>
- {isBundleOnly ? "Access bundle hosts only" : "Any host"}
+ {isServiceHostsOnly ? "Service hosts only" : "Any host"}
{allowedHosts.length > 0 &&
` · ${allowedHosts.length} ${allowedHosts.length === 1 ? "exception" : "exceptions"}`}
</span>
diff --git a/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx b/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx
index b59bbcc10a..0a8e2a4c5d 100644
--- a/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultProxiesPage/components/ProxyFormDialog.tsx
@@ -35,6 +35,7 @@ import {
import { addHostListIssues } from "@app/helpers/agentVaultHostPattern";
import {
AgentVaultTrafficPolicy,
+ isServiceHostsPolicy,
useCreateAgentVaultProxy,
useUpdateAgentVaultProxy
} from "@app/hooks/api/agentVault";
@@ -48,9 +49,9 @@ const TRAFFIC_POLICY_CHOICES = [
description: "Allow requests to reach any host."
},
{
- value: AgentVaultTrafficPolicy.BundleHosts,
- title: "Access bundle hosts only",
- description: "Only allow requests to reach hosts specified in access bundles."
+ value: AgentVaultTrafficPolicy.ServiceHosts,
+ title: "Service hosts only",
+ description: "Only allow requests to reach hosts that the session's services cover."
}
];
@@ -72,10 +73,10 @@ const schema = z
.max(300, "Poll interval must be at most 300 seconds")
)
})
- // Only under the bundle-hosts policy, where the field is on screen: an any-host proxy ignores the
+ // Only under the service-hosts policy, where the field is on screen: an any-host proxy ignores the
// list, and a stale value in a hidden field would block Save with an error nothing shows.
.superRefine((data, ctx) => {
- if (data.trafficPolicy !== AgentVaultTrafficPolicy.BundleHosts) return;
+ if (data.trafficPolicy !== AgentVaultTrafficPolicy.ServiceHosts) return;
addHostListIssues(data.allowedHosts, ctx, ["allowedHosts"]);
});
@@ -141,7 +142,7 @@ export const ProxyFormDialog = ({ isOpen, onOpenChange, proxy, onCreated }: Prop
formState: { isSubmitting }
} = useForm<FormData>({ resolver: zodResolver(schema) });
- const isBundleOnly = watch("trafficPolicy") === AgentVaultTrafficPolicy.BundleHosts;
+ const isServiceHostsOnly = watch("trafficPolicy") === AgentVaultTrafficPolicy.ServiceHosts;
const saveDelayNote = (() => {
if (!shownProxy?.heartbeat) return null;
@@ -155,7 +156,10 @@ export const ProxyFormDialog = ({ isOpen, onOpenChange, proxy, onCreated }: Prop
reset({
name: proxy?.name ?? "",
- trafficPolicy: proxy?.trafficPolicy ?? AgentVaultTrafficPolicy.AnyHost,
+ trafficPolicy:
+ proxy && isServiceHostsPolicy(proxy.trafficPolicy)
+ ? AgentVaultTrafficPolicy.ServiceHosts
+ : AgentVaultTrafficPolicy.AnyHost,
allowedHosts: proxy?.allowedHosts ?? "",
pollInterval: proxy?.pollInterval ?? 60
});
@@ -217,7 +221,7 @@ export const ProxyFormDialog = ({ isOpen, onOpenChange, proxy, onCreated }: Prop
</Field>
)}
/>
- {isBundleOnly && (
+ {isServiceHostsOnly && (
<Controller
control={control}
name="allowedHosts"
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
index 1c7f4f2170..e6d6745608 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
@@ -337,7 +337,7 @@ export const AgentVaultSessionsPage = () => {
<DocumentationLinkBadge href={AgentVaultDocsUrls.sessions} />
</CardTitle>
<CardDescription>
- A session names the actor who holds it, the access bundle it carries, and when it
+ A session names the actor who holds it, the services it can reach, and when it
expires.
</CardDescription>
<CardAction>
@@ -430,7 +430,7 @@ export const AgentVaultSessionsPage = () => {
{/* w-px holds the column to its capped content, so a long label truncates at the column's edge */}
<TableHead className="w-px">Label</TableHead>
<TableHead>Identity</TableHead>
- <TableHead>Access Bundle</TableHead>
+ <TableHead>Access</TableHead>
<TableHead>Created</TableHead>
<TableHead>Expires</TableHead>
<TableHead>Status</TableHead>
@@ -473,8 +473,8 @@ export const AgentVaultSessionsPage = () => {
items={toAccessItems(session)}
getKey={(item) =>
item.kind === "bundle"
- ? (item.bundle.id ?? item.bundle.name)
- : "inline-services"
+ ? `bundle:${item.bundle.id ?? item.bundle.name}`
+ : "inline"
}
getLabel={(item) =>
item.kind === "bundle"
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/InlineServicesHoverCard.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/InlineServicesHoverCard.tsx
index 7d592f44dd..496497045a 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/InlineServicesHoverCard.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/InlineServicesHoverCard.tsx
@@ -9,7 +9,7 @@ import {
} from "@app/components/v3";
import { TAgentVaultSessionInlineService } from "@app/hooks/api/agentVault/types";
-import { inlineServiceDisplayName } from "./sessionInlineServices";
+import { inlineServiceTarget } from "./sessionInlineServices";
type ListProps = {
services: TAgentVaultSessionInlineService[];
@@ -28,15 +28,19 @@ export const InlineServicesList = ({ services }: ListProps) => (
contentClassName="flex flex-col gap-2"
onWheel={(event) => event.stopPropagation()}
>
- {services.map((service) => (
- <div key={service.id} className="flex min-w-0 items-center gap-2">
- <ServiceIcon hostPattern={service.hostPattern} className="size-5" />
- <span className="truncate">{inlineServiceDisplayName(service)}</span>
- {service.name && (
- <span className="truncate text-xs text-muted">{service.hostPattern.split(",")[0]}</span>
- )}
- </div>
- ))}
+ {services.map((service) => {
+ const target = inlineServiceTarget(service);
+ return (
+ <div key={service.id} className="flex min-w-0 items-center gap-2">
+ <ServiceIcon hostPattern={service.hostPattern} className="size-5" />
+ <span className="truncate">{service.name}</span>
+ {/* A service sent without a name goes by its host, which would only repeat here. */}
+ {target !== service.name && (
+ <span className="truncate text-xs text-muted">{target}</span>
+ )}
+ </div>
+ );
+ })}
</ScrollableContent>
</div>
);
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx
index 14c3b01a1f..ad33a3114f 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx
@@ -32,7 +32,7 @@ import { useAgentVaultSheetState } from "@app/hooks/useAgentVaultSheetState";
import { InlineServicesHoverCard } from "./InlineServicesHoverCard";
import { SessionExpiry } from "./SessionExpiry";
-import { inlineServiceDisplayName } from "./sessionInlineServices";
+import { inlineServiceTarget } from "./sessionInlineServices";
import { SessionLogsPanel } from "./SessionLogsPanel";
import { SessionStatusBadge } from "./SessionStatusBadge";
@@ -191,14 +191,12 @@ export const SessionDetailSheet = ({
hostPattern={service.hostPattern}
className="size-5"
/>
- <span className="truncate">
- {inlineServiceDisplayName(service)}
- </span>
+ <span className="truncate">{service.name}</span>
</span>
</TooltipTrigger>
<TooltipContent>
Sent with this session when it was created, for{" "}
- {service.hostPattern.split(",").join(", ")}
+ {inlineServiceTarget(service)}
</TooltipContent>
</Tooltip>
))}
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/sessionInlineServices.ts b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/sessionInlineServices.ts
index b3d3993d0a..b27da8b46a 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/sessionInlineServices.ts
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/sessionInlineServices.ts
@@ -1,15 +1,20 @@
+import { displayHostPattern } from "@app/components/agent-vault/service-sheet/serviceSchema";
+import { AgentVaultServiceType } from "@app/hooks/api/agentVault/enums";
import {
TAgentVaultSession,
TAgentVaultSessionAccessBundle,
TAgentVaultSessionInlineService
} from "@app/hooks/api/agentVault/types";
-// The same fallback the API uses wherever it names an inline service sent without a name: its first host.
-export const inlineServiceDisplayName = ({
- name,
+// Where the service reaches, shown the way an access bundle's services are: an MCP server by its URL.
+export const inlineServiceTarget = ({
+ type,
+ serverUrl,
hostPattern
-}: Pick<TAgentVaultSessionInlineService, "name" | "hostPattern">) =>
- name || hostPattern.split(",")[0].trim();
+}: Pick<TAgentVaultSessionInlineService, "type" | "serverUrl" | "hostPattern">) =>
+ type === AgentVaultServiceType.Mcp && serverUrl
+ ? serverUrl.replace(/^https:\/\//i, "")
+ : displayHostPattern(hostPattern);
export const inlineServicesLabel = (count: number) =>
count === 1 ? "1 inline service" : `${count} inline services`;