The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
fix(agents): redact plaintext env values in agent read and mutation responses (#9860)
Paperclip DevOps Engineer31a63638ac22
diff --git a/server/src/__tests__/agent-permissions-routes.test.ts b/server/src/__tests__/agent-permissions-routes.test.tsindex 4eadf5318a..cc6fe817e4 100644--- a/server/src/__tests__/agent-permissions-routes.test.ts+++ b/server/src/__tests__/agent-permissions-routes.test.ts@@ -43,6 +43,7 @@ const baseAgent = {const mockAgentService = vi.hoisted(() => ({getById: vi.fn(),getConfigRevision: vi.fn(),+ listConfigRevisions: vi.fn(),list: vi.fn(),create: vi.fn(),activatePendingApproval: vi.fn(),@@ -291,6 +292,7 @@ describe.sequential("agent permission routes", () => {vi.resetAllMocks();mockAgentService.getById.mockReset();mockAgentService.getConfigRevision.mockReset();+ mockAgentService.listConfigRevisions.mockReset();mockAgentService.list.mockReset();mockAgentService.create.mockReset();mockAgentService.activatePendingApproval.mockReset();@@ -337,6 +339,7 @@ describe.sequential("agent permission routes", () => {mockGetTelemetryClient.mockReturnValue({ track: vi.fn() });mockAgentService.getById.mockResolvedValue(baseAgent);mockAgentService.getConfigRevision.mockResolvedValue(null);+ mockAgentService.listConfigRevisions.mockResolvedValue([]);mockAgentService.list.mockResolvedValue([baseAgent]);mockAgentService.getChainOfCommand.mockResolvedValue([]);mockAgentService.resolveByReference.mockResolvedValue({ ambiguous: false, agent: baseAgent });@@ -422,7 +425,8 @@ describe.sequential("agent permission routes", () => {expect(res.body.runtimeConfig).toEqual({});}, 20_000);- it("keeps board agent detail unredacted for low-trust agents", async () => {+ it("redacts env values in board agent detail responses", async () => {+ const plaintextValue = "plain-value-must-not-leak";mockAgentService.getById.mockResolvedValue({...baseAgent,permissions: {@@ -431,7 +435,15 @@ describe.sequential("agent permission routes", () => {},adapterConfig: {command: "pnpm agent:run",- env: { PAPERCLIP_API_KEY: "secret-test-key" },+ env: {+ LEGACY_VALUE: plaintextValue,+ PLAIN_VALUE: { type: "plain", value: plaintextValue },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "33333333-3333-4333-8333-333333333333",+ version: "latest",+ },+ },},runtimeConfig: {heartbeat: { enabled: false },@@ -451,14 +463,190 @@ describe.sequential("agent permission routes", () => {expect(res.status).toBe(200);expect(res.body.adapterConfig).toMatchObject({command: "pnpm agent:run",- env: { PAPERCLIP_API_KEY: "secret-test-key" },+ env: {+ LEGACY_VALUE: { type: "plain", value: "***REDACTED***" },+ PLAIN_VALUE: { type: "plain", value: "***REDACTED***" },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "33333333-3333-4333-8333-333333333333",+ version: "latest",+ },+ },});+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);expect(res.body.runtimeConfig).toMatchObject({heartbeat: { enabled: false },});expect(res.body.permissions).toMatchObject({ trustPreset: LOW_TRUST_REVIEW_PRESET });}, 20_000);+ // TEC-7032 reported the leak against the company agent-list endpoint, which+ // serialises rows directly instead of going through buildAgentDetail.+ it("redacts env values in board GET /api/companies/:companyId/agents responses", async () => {+ const plaintextValue = "listed-value-must-not-leak";+ mockAgentService.list.mockResolvedValue([+ {+ ...baseAgent,+ adapterConfig: {+ command: "pnpm agent:run",+ env: {+ LEGACY_VALUE: plaintextValue,+ PLAIN_VALUE: { type: "plain", value: plaintextValue },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "55555555-5555-4555-8555-555555555555",+ version: "latest",+ },+ },+ },+ },+ ]);++ const app = await createApp({+ type: "board",+ userId: "board-user",+ source: "local_implicit",+ isInstanceAdmin: true,+ companyIds: [companyId],+ });++ const res = await requestApp(app, (baseUrl) =>+ request(baseUrl).get(`/api/companies/${companyId}/agents`),+ );++ expect(res.status).toBe(200);+ expect(res.body).toHaveLength(1);+ expect(res.body[0].adapterConfig).toMatchObject({+ command: "pnpm agent:run",+ env: {+ LEGACY_VALUE: { type: "plain", value: "***REDACTED***" },+ PLAIN_VALUE: { type: "plain", value: "***REDACTED***" },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "55555555-5555-4555-8555-555555555555",+ version: "latest",+ },+ },+ });+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);+ }, 20_000);++ // Mutation routes echo the stored row back, so they leak the same values the+ // GET paths redact.+ it("redacts env values in agent mutation responses", async () => {+ const plaintextValue = "mutation-value-must-not-leak";+ const storedAgent = {+ ...baseAgent,+ adapterConfig: {+ env: { PLAIN_VALUE: { type: "plain", value: plaintextValue } },+ },+ };+ mockAgentService.getById.mockResolvedValue(storedAgent);+ mockAgentService.update.mockResolvedValue(storedAgent);++ const app = await createApp({+ type: "board",+ userId: "board-user",+ source: "local_implicit",+ isInstanceAdmin: true,+ companyIds: [companyId],+ });++ const res = await requestApp(app, (baseUrl) =>+ request(baseUrl).patch(`/api/agents/${agentId}`).send({ title: "Renamed" }),+ );++ expect(res.status).toBe(200);+ expect(res.body.adapterConfig.env).toEqual({+ PLAIN_VALUE: { type: "plain", value: "***REDACTED***" },+ });+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);+ }, 20_000);++ it("redacts env values in GET /api/agents/me responses", async () => {+ const plaintextValue = "self-value-must-not-leak";+ mockAgentService.getById.mockResolvedValue({+ ...baseAgent,+ adapterConfig: {+ env: {+ EXISTING_VALUE: plaintextValue,+ NEW_VALUE: { type: "plain", value: plaintextValue },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "44444444-4444-4444-8444-444444444444",+ version: 2,+ },+ },+ },+ });++ const app = await createApp({+ type: "agent",+ agentId,+ companyId,+ runId: null,+ source: "agent_key",+ });++ const res = await requestApp(app, (baseUrl) => request(baseUrl).get("/api/agents/me"));++ expect(res.status).toBe(200);+ expect(res.body.adapterConfig.env).toEqual({+ EXISTING_VALUE: { type: "plain", value: "***REDACTED***" },+ NEW_VALUE: { type: "plain", value: "***REDACTED***" },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "44444444-4444-4444-8444-444444444444",+ version: 2,+ },+ });+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);+ }, 20_000);++ it("preserves stored env values when a redacted detail response is submitted unchanged", async () => {+ const plaintextValue = "stored-value-must-be-preserved";+ mockAgentService.getById.mockResolvedValue({+ ...baseAgent,+ adapterConfig: {+ env: {+ EXISTING_VALUE: { type: "plain", value: plaintextValue },+ },+ },+ });+ mockAgentService.update.mockResolvedValue(baseAgent);++ const app = await createApp({+ type: "board",+ userId: "board-user",+ source: "local_implicit",+ isInstanceAdmin: true,+ companyIds: [companyId],+ });++ const redactedResponse = await requestApp(app, (baseUrl) =>+ request(baseUrl).get(`/api/agents/${agentId}`),+ );+ expect(redactedResponse.status).toBe(200);+ const redactedEnv = redactedResponse.body.adapterConfig.env as Record<string, unknown>;+ expect(redactedEnv.EXISTING_VALUE).toEqual({ type: "plain", value: "***REDACTED***" });++ const patchRes = await requestApp(app, (baseUrl) =>+ request(baseUrl).patch(`/api/agents/${agentId}`).send({+ title: "Renamed while redacted env round-trips",+ adapterConfig: redactedResponse.body.adapterConfig,+ }),+ );++ expect(patchRes.status).toBe(200);+ const updateCallArgs = mockAgentService.update.mock.calls[0]?.[1] as+ | { adapterConfig?: Record<string, unknown> }+ | undefined;+ expect(updateCallArgs?.adapterConfig?.env).toEqual({+ EXISTING_VALUE: { type: "plain", value: plaintextValue },+ });+ expect(JSON.stringify(updateCallArgs?.adapterConfig ?? {})).not.toContain("***REDACTED***");+ }, 20_000);+it("redacts company agent list for authenticated company members without agent admin permission", async () => {mockAccessService.canUser.mockResolvedValue(false);mockAccessService.decide.mockImplementation(async (input: { action?: string }) => ({@@ -628,6 +816,43 @@ describe.sequential("agent permission routes", () => {expect(mockAgentService.rollbackConfigRevision).not.toHaveBeenCalled();});+ it("redacts plaintext env values in configuration rollback responses", async () => {+ const revisionId = "33333333-3333-4333-8333-333333333333";+ const plaintextValue = "rollback-value-must-not-leak";+ mockAgentService.getConfigRevision.mockResolvedValue({+ id: revisionId,+ afterConfig: {+ adapterType: "process",+ adapterConfig: {},+ runtimeConfig: {},+ },+ });+ mockAgentService.rollbackConfigRevision.mockResolvedValue({+ ...baseAgent,+ adapterConfig: {+ env: { GENERIC_NAME: { type: "plain", value: plaintextValue } },+ },+ });++ const app = await createApp({+ type: "board",+ userId: "instance-admin-user",+ source: "session",+ isInstanceAdmin: true,+ companyIds: [companyId],+ });++ const res = await requestApp(app, (baseUrl) =>+ request(baseUrl).post(`/api/agents/${agentId}/config-revisions/${revisionId}/rollback`),+ );++ expect(res.status).toBe(200);+ expect(res.body.adapterConfig.env).toEqual({+ GENERIC_NAME: { type: "plain", value: "***REDACTED***" },+ });+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);+ });+it("blocks api key creation for authenticated company members without agent admin permission", async () => {mockAccessService.canUser.mockResolvedValue(false);@@ -1649,6 +1874,13 @@ describe.sequential("agent permission routes", () => {// the read-only permission loosening introduced by this PR.mockAccessService.canUser.mockResolvedValue(false);mockAccessService.hasPermission.mockResolvedValue(false);+ const plaintextValue = "configuration-value-must-not-leak";+ mockAgentService.getById.mockResolvedValue({+ ...baseAgent,+ adapterConfig: {+ env: { GENERIC_NAME: { type: "plain", value: plaintextValue } },+ },+ });const app = await createApp({type: "board",@@ -1661,6 +1893,78 @@ describe.sequential("agent permission routes", () => {const res = await request(app).get(`/api/agents/${agentId}/configuration`);expect(res.status).toBe(200);+ expect(res.body.adapterConfig.env).toEqual({+ GENERIC_NAME: { type: "plain", value: "***REDACTED***" },+ });+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);+ });++ it("redacts plaintext env values in company configuration-list responses", async () => {+ const plaintextValue = "configuration-list-value-must-not-leak";+ mockAgentService.list.mockResolvedValue([+ {+ ...baseAgent,+ adapterConfig: {+ env: { GENERIC_NAME: { type: "plain", value: plaintextValue } },+ },+ },+ ]);++ const app = await createApp({+ type: "board",+ userId: "board-user",+ source: "session",+ isInstanceAdmin: false,+ companyIds: [companyId],+ });++ const res = await request(app).get(`/api/companies/${companyId}/agent-configurations`);++ expect(res.status).toBe(200);+ expect(res.body[0].adapterConfig.env).toEqual({+ GENERIC_NAME: { type: "plain", value: "***REDACTED***" },+ });+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);+ });++ it("redacts plaintext env values in configuration revisions", async () => {+ const plaintextValue = "revision-value-must-not-leak";+ mockAgentService.listConfigRevisions.mockResolvedValue([+ {+ id: "33333333-3333-4333-8333-333333333333",+ beforeConfig: {+ adapterConfig: {+ env: { GENERIC_NAME: { type: "plain", value: plaintextValue } },+ },+ },+ afterConfig: {+ adapterConfig: {+ env: { GENERIC_NAME: plaintextValue },+ },+ },+ },+ ]);++ const app = await createApp({+ type: "board",+ userId: "board-user",+ source: "session",+ isInstanceAdmin: false,+ companyIds: [companyId],+ });++ const res = await request(app).get(`/api/agents/${agentId}/config-revisions`);++ expect(res.status).toBe(200);+ expect(res.body[0].beforeConfig.adapterConfig.env.GENERIC_NAME).toEqual({+ type: "plain",+ value: "***REDACTED***",+ });+ expect(res.body[0].afterConfig.adapterConfig.env.GENERIC_NAME).toEqual({+ type: "plain",+ value: "***REDACTED***",+ });+ expect(JSON.stringify(res.body)).not.toContain(plaintextValue);});it("denies an agent actor without configure or suggest grants when reading peer config", async () => {diff --git a/server/src/__tests__/redaction.test.ts b/server/src/__tests__/redaction.test.tsindex 2de97caf96..b42699be7c 100644--- a/server/src/__tests__/redaction.test.ts+++ b/server/src/__tests__/redaction.test.ts@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";import {PRP_V1_EVENT_TYPES,REDACTED_EVENT_VALUE,+ redactAgentAdapterConfig,redactEventPayload,redactSensitiveText,sanitizeRecord,@@ -626,4 +627,73 @@ second-line\" status=401`,expect(result?.args).toEqual(["--api-key", "not-a-command-secret"]);expect(result?.argv).toEqual(["--api-key", REDACTED_EVENT_VALUE]);});++ it("redacts every plaintext agent env binding while preserving secret references", () => {+ const plaintextValue = "adapter-env-value-must-not-leak";++ const result = redactAgentAdapterConfig({+ command: "pnpm agent:run",+ env: {+ EXISTING_VALUE: plaintextValue,+ NEW_VALUE: { type: "plain", value: plaintextValue },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "55555555-5555-4555-8555-555555555555",+ version: "latest",+ },+ USER_SECRET_REFERENCE: {+ type: "user_secret_ref",+ key: "GITHUB_TOKEN",+ },+ },+ });++ expect(result).toEqual({+ command: "pnpm agent:run",+ env: {+ EXISTING_VALUE: { type: "plain", value: REDACTED_EVENT_VALUE },+ NEW_VALUE: { type: "plain", value: REDACTED_EVENT_VALUE },+ SECRET_REFERENCE: {+ type: "secret_ref",+ secretId: "55555555-5555-4555-8555-555555555555",+ version: "latest",+ },+ USER_SECRET_REFERENCE: {+ type: "user_secret_ref",+ key: "GITHUB_TOKEN",+ },+ },+ });+ expect(JSON.stringify(result)).not.toContain(plaintextValue);+ });++ it("redacts non-env adapter keys while leaving env binding shapes intact", () => {+ const result = redactAgentAdapterConfig({+ command: "pnpm agent:run",+ apiKey: "adapter-level-secret",+ env: {+ API_KEY: "env-level-secret",+ AUTH_TOKEN: { type: "plain", value: "another-env-secret" },+ },+ });++ // Non-env keys still go through the shared payload sanitizer.+ expect(result.apiKey).toBe(REDACTED_EVENT_VALUE);+ expect(result.command).toBe("pnpm agent:run");++ // Env bindings keep their binding shape rather than collapsing to a bare+ // sentinel string, which is what a second sanitizer pass would produce for+ // these sensitive-looking key names.+ expect(result.env).toEqual({+ API_KEY: { type: "plain", value: REDACTED_EVENT_VALUE },+ AUTH_TOKEN: { type: "plain", value: REDACTED_EVENT_VALUE },+ });+ });++ it("redacts adapter configs that have no env block", () => {+ expect(redactAgentAdapterConfig({ command: "pnpm agent:run", apiKey: "secret" })).toEqual({+ command: "pnpm agent:run",+ apiKey: REDACTED_EVENT_VALUE,+ });+ });});diff --git a/server/src/redaction.ts b/server/src/redaction.tsindex fe381887ea..e9a29c5531 100644--- a/server/src/redaction.ts+++ b/server/src/redaction.ts@@ -941,6 +941,35 @@ export function redactEventPayload(return sanitized;}+function redactAgentEnvBinding(value: unknown): unknown {+ if (isSecretRefBinding(value) || isUserSecretRefBinding(value)) {+ return sanitizeValue(value);+ }+ if (typeof value === "string" || isPlainBinding(value)) {+ return { type: "plain", value: REDACTED_EVENT_VALUE };+ }+ if (value === null || value === undefined) return value;+ return REDACTED_EVENT_VALUE;+}++export function redactAgentAdapterConfig(+ adapterConfig: Record<string, unknown>,+): Record<string, unknown> {+ if (!isPlainObject(adapterConfig)) return adapterConfig;+ if (!isPlainObject(adapterConfig.env)) return redactEventPayload(adapterConfig) ?? {};++ // Redact `env` here and sanitize the remaining keys separately, so bindings+ // are never processed twice. `redactAgentEnvBinding` is authoritative for+ // `env`; keeping it out of `sanitizeRecord` means a future change there+ // cannot alter entries this function has already redacted.+ const { env, ...rest } = adapterConfig;+ const redactedEnv = Object.fromEntries(+ Object.entries(env).map(([key, value]) => [key, redactAgentEnvBinding(value)]),+ );++ return { ...(redactEventPayload(rest) ?? {}), env: redactedEnv };+}+export function redactSensitiveText(input: string): string {if (!maybeContainsSecretText(input)) return input;return redactCommandText(diff --git a/server/src/routes/agents.ts b/server/src/routes/agents.tsindex d13477d0a9..6e3873ddc7 100644--- a/server/src/routes/agents.ts+++ b/server/src/routes/agents.ts@@ -105,7 +105,11 @@ import {refreshAdapterModels,requireServerAdapter,} from "../adapters/index.js";-import { redactEventPayload } from "../redaction.js";+import {+ REDACTED_EVENT_VALUE,+ redactAgentAdapterConfig,+ redactEventPayload,+} from "../redaction.js";import { redactCurrentUserValue } from "../log-redaction.js";import {HarnessRuntimeRequestResolutionError,@@ -1483,8 +1487,12 @@ export function agentRoutes(buildAgentAccessState(agent),]);+ const baseAgent = redactAgentRowForResponse(+ options?.restricted ? redactForRestrictedAgentView(agent) : agent,+ );+return {- ...(options?.restricted ? redactForRestrictedAgentView(agent) : agent),+ ...baseAgent,chainOfCommand,access: accessState,};@@ -2773,6 +2781,21 @@ export function agentRoutes(};}+ // Single presenter for every response that emits a raw agent row. Restricted+ // views blank the config wholesale for authorization reasons; this runs for+ // config-reading (board) callers too, so plaintext `adapterConfig.env` values+ // never leave the API regardless of actor scope.+ function redactAgentRowForResponse<T extends { adapterConfig?: unknown } | null | undefined>(+ agent: T,+ ): T {+ if (!agent || typeof agent !== "object") return agent;+ if (!agent.adapterConfig || typeof agent.adapterConfig !== "object") return agent;+ return {+ ...agent,+ adapterConfig: redactAgentAdapterConfig(agent.adapterConfig as Record<string, unknown>),+ };+ }+function redactAgentConfiguration(agent: Awaited<ReturnType<typeof svc.getById>>) {if (!agent) return null;return {@@ -2784,19 +2807,41 @@ export function agentRoutes(status: agent.status,reportsTo: agent.reportsTo,adapterType: agent.adapterType,- adapterConfig: redactEventPayload(agent.adapterConfig),+ adapterConfig: redactAgentAdapterConfig(agent.adapterConfig),runtimeConfig: redactEventPayload(agent.runtimeConfig),permissions: agent.permissions,updatedAt: agent.updatedAt,};}+ function restoreRedactedAgentEnv(+ requestedConfig: Record<string, unknown>,+ existingConfig: Record<string, unknown>,+ ): Record<string, unknown> {+ const requestedEnv = asRecord(requestedConfig.env);+ const existingEnv = asRecord(existingConfig.env);+ if (!requestedEnv || !existingEnv) return requestedConfig;++ const restoredEnv = { ...requestedEnv };+ for (const [key, value] of Object.entries(requestedEnv)) {+ const binding = asRecord(value);+ if (+ binding?.type === "plain"+ && binding.value === REDACTED_EVENT_VALUE+ && Object.prototype.hasOwnProperty.call(existingEnv, key)+ ) {+ restoredEnv[key] = existingEnv[key];+ }+ }+ return { ...requestedConfig, env: restoredEnv };+ }+function redactRevisionSnapshot(snapshot: unknown): Record<string, unknown> {if (!snapshot || typeof snapshot !== "object" || Array.isArray(snapshot)) return {};const record = snapshot as Record<string, unknown>;return {...record,- adapterConfig: redactEventPayload(+ adapterConfig: redactAgentAdapterConfig(typeof record.adapterConfig === "object" && record.adapterConfig !== null? (record.adapterConfig as Record<string, unknown>): {},@@ -3466,7 +3511,7 @@ export function agentRoutes(const result = await filterAgentsForActor(req, await svc.list(companyId));const canReadConfigs = await actorCanReadConfigurationsForCompany(req, companyId);if (canReadConfigs) {- res.json(result);+ res.json(result.map((agent) => redactAgentRowForResponse(agent)));return;}res.json(result.map((agent) => redactForRestrictedAgentView(agent)));@@ -3806,7 +3851,7 @@ export function agentRoutes(details: { revisionId },});- res.json(updated);+ res.json(redactAgentRowForResponse(updated));});router.get("/agents/:id/runtime-state", async (req, res) => {@@ -4210,7 +4255,7 @@ export function agentRoutes();}- res.status(201).json(agent);+ res.status(201).json(redactAgentRowForResponse(agent));});router.patch("/agents/:id/permissions", validate(updateAgentPermissionsSchema), async (req, res) => {@@ -4575,9 +4620,11 @@ export function agentRoutes() {await assertCanManageInstructionsPath(req, existing);}- let rawEffectiveAdapterConfig = requestedAdapterConfig ?? existingAdapterConfig;+ let rawEffectiveAdapterConfig = requestedAdapterConfig+ ? restoreRedactedAgentEnv(requestedAdapterConfig, existingAdapterConfig)+ : existingAdapterConfig;if (requestedAdapterConfig && !changingAdapterType && !replaceAdapterConfig) {- rawEffectiveAdapterConfig = { ...existingAdapterConfig, ...requestedAdapterConfig };+ rawEffectiveAdapterConfig = { ...existingAdapterConfig, ...rawEffectiveAdapterConfig };}if (changingAdapterType) {// Preserve adapter-agnostic keys (env, cwd, etc.) from the existing config@@ -4688,7 +4735,7 @@ export function agentRoutes(details: summarizeAgentUpdateDetails(patchData),});- res.json(agent);+ res.json(redactAgentRowForResponse(agent));});router.post("/agents/:id/pause", async (req, res) => {@@ -4714,7 +4761,7 @@ export function agentRoutes(entityId: agent.id,});- res.json(agent);+ res.json(redactAgentRowForResponse(agent));});router.post("/agents/:id/resume", async (req, res) => {@@ -4749,7 +4796,7 @@ export function agentRoutes(entityId: agent.id,});- res.json(agent);+ res.json(redactAgentRowForResponse(agent));});router.post("/agents/:id/clear-error", async (req, res) => {@@ -4781,7 +4828,7 @@ export function agentRoutes(entityId: agent.id,});- res.json(agent);+ res.json(redactAgentRowForResponse(agent));});router.post("/agents/:id/approve", async (req, res) => {@@ -4835,7 +4882,7 @@ export function agentRoutes(details: { source: "agent_detail", approvalId: openApproval?.id ?? null },});- res.json(agent);+ res.json(redactAgentRowForResponse(agent));});router.post("/agents/:id/terminate", async (req, res) => {@@ -4905,7 +4952,7 @@ export function agentRoutes(},});- res.json(agent);+ res.json(redactAgentRowForResponse(agent));});router.delete("/agents/:id", async (req, res) => {