Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(mcp-host): rename secret-shaped fixtures the public boundary rejects
Alfredo Lopez4a7ed3cec57a
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex cf8571d47..d2bd708b7 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.512",+ "version": "0.1.513","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.512",+ "version": "0.1.513","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 818ac44eb..ef8b4ca87 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.512",+ "version": "0.1.513","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/core/orchestration/__tests__/toolUseLoopSingleTool.errorRedaction.test.ts b/mcp-host/src/core/orchestration/__tests__/toolUseLoopSingleTool.errorRedaction.test.tsindex b3ac191db..79d1bec54 100644--- a/mcp-host/src/core/orchestration/__tests__/toolUseLoopSingleTool.errorRedaction.test.ts+++ b/mcp-host/src/core/orchestration/__tests__/toolUseLoopSingleTool.errorRedaction.test.ts@@ -15,8 +15,8 @@ import { SimpleEventEmitter } from '../eventEmitter'import { buildLoopConfig } from '../loopConfig'import { runToolUseLoop } from '../toolUseLoop'-const TOKEN = 'ghp_Q1w2E3r4T5y6U7i8O9p0A1s2D3f4G5h6J7k8'-const TOKEN_BODY = TOKEN.slice('ghp_'.length)+const GITHUB_PAT = 'ghp_Q1w2E3r4T5y6U7i8O9p0A1s2D3f4G5h6J7k8'+const GITHUB_PAT_BODY = GITHUB_PAT.slice('ghp_'.length)const UPSTREAM = 'upstream refused the request with credential'function throwingTool(): Tool & { execute: ReturnType<typeof vi.fn> } {@@ -25,7 +25,7 @@ function throwingTool(): Tool & { execute: ReturnType<typeof vi.fn> } {description: () => 'Fetch a repository',parametersSchema: () => ({ type: 'object', properties: {} }),execute: vi.fn(async (): Promise<ToolOutput> => {- throw new Error(`${UPSTREAM} ${TOKEN}`)+ throw new Error(`${UPSTREAM} ${GITHUB_PAT}`)}),requiresSanitization: () => true,requiresApproval: () => false,@@ -94,16 +94,16 @@ describe('executeSingleTool — thrown error text is sanitized (A15 item 6)', ()expect(transformed.isError).toBe(true)expect(transformed.content).toContain(`Tool execution failed: ${UPSTREAM}`)expect(transformed.content).toContain('[REDACTED]')- expect(transformed.content).not.toContain(TOKEN_BODY)+ expect(transformed.content).not.toContain(GITHUB_PAT_BODY)// The result and the messages the model receives.const toModel = resultsForModel[0]![0]!expect(toModel).toMatchObject({ tool_call_id: 'tc_1', is_error: true })expect(toModel.content).toContain(`Tool execution failed: ${UPSTREAM}`)- expect(toModel.content).not.toContain(TOKEN_BODY)+ expect(toModel.content).not.toContain(GITHUB_PAT_BODY)const toolMessages = messagesForModel[0]!.filter(message => message.role === 'tool')expect(toolMessages).toHaveLength(1)expect(JSON.stringify(toolMessages[0])).toContain(UPSTREAM)- expect(JSON.stringify(messagesForModel[0])).not.toContain(TOKEN_BODY)+ expect(JSON.stringify(messagesForModel[0])).not.toContain(GITHUB_PAT_BODY)})})diff --git a/mcp-host/src/core/tools/__tests__/nativeToolRegistry.attachmentRead.test.ts b/mcp-host/src/core/tools/__tests__/nativeToolRegistry.attachmentRead.test.tsindex 6364b8774..758d8115a 100644--- a/mcp-host/src/core/tools/__tests__/nativeToolRegistry.attachmentRead.test.ts+++ b/mcp-host/src/core/tools/__tests__/nativeToolRegistry.attachmentRead.test.ts@@ -263,8 +263,8 @@ describe('NativeToolRegistry — clerum__attachment_read (#666)', () => {// unless the tool masked it against the whole text first.it('masks a ConfigStore secret split across pages with the turn secretEntriesProvider', async () => {const TOOL = 'clerum__attachment_read'- const secret = 'CfgLiteralSecretValue9f8e7d'- const secretEntriesProvider = () => [{ name: 'CFG_TOKEN', value: secret }]+ const configLiteral = 'CfgLiteralSecretValue9f8e7d'+ const secretEntriesProvider = () => [{ name: 'CFG_TOKEN', value: configLiteral }]// What the loop applies to every page: the same ConfigStore secrets.const loopSafety = new BasicSafety(secretEntriesProvider)const context = {@@ -273,7 +273,7 @@ describe('NativeToolRegistry — clerum__attachment_read (#666)', () => {Math.ceil(Buffer.byteLength(loopSafety.previewOutputForLlm(TOOL, raw), 'utf8') / 4) + 4,}const before = 'intro text line\n'- const text = before + secret + '\ntrailing words here\n'+ const text = before + configLiteral + '\ntrailing words here\n'const bytes = Buffer.from(text)const validated = validateIncomingAttachments([@@ -320,8 +320,8 @@ describe('NativeToolRegistry — clerum__attachment_read (#666)', () => {}/** The first 6-character piece of the secret that `visible` shows, if any. */const leakedPiece = (visible: string): string | null => {- for (let i = 0; i + 6 <= secret.length; i++) {- if (visible.includes(secret.slice(i, i + 6))) return secret.slice(i, i + 6)+ for (let i = 0; i + 6 <= configLiteral.length; i++) {+ if (visible.includes(configLiteral.slice(i, i + 6))) return configLiteral.slice(i, i + 6)}return null}@@ -337,7 +337,7 @@ describe('NativeToolRegistry — clerum__attachment_read (#666)', () => {expect(leakedPiece(whole.visible)).toBeNull()// Split: the first page ends in the middle of the literal.- const splitAt = Buffer.byteLength(before) + Math.floor(secret.length / 2)+ const splitAt = Buffer.byteLength(before) + Math.floor(configLiteral.length / 2)const pages: Awaited<ReturnType<typeof readPage>>[] = []let offset = 0for (;;) {