History

fix(claude): redact launch arguments from protocol logs

Fixes review: https://github.com/pingdotgg/t3code/pull/2829#discussion_r3471595059

Julius Marminge committed 3 months ago

Commit 3bc39bc1 parent ef19b9d2 files · +7 −2Browse files

Unified · Split

2 files
  1. apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts +5 −0
  2. apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts +2 −2
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts+5−0
@@ -497,6 +497,9 @@ describe("ClaudeAdapterV2 native protocol logging", () => { · 496 unmodified lines
497497 env: {
498498 ANTHROPIC_API_KEY: "secret",
499499 },
500+ extraArgs: {
501+ "append-system-prompt": "secret launch prompt",
502+ },
500503 canUseTool: (_toolName, input, callbackOptions) =>
501504 Promise.resolve({
502505 behavior: "allow",
@@ -517,7 +520,9 @@ describe("ClaudeAdapterV2 native protocol logging", () => { · 14 unmodified lines
517520 cwd: "/workspace",
518521 hasCanUseTool: true,
519522 hasEnvironment: true,
523+ hasExtraArgs: true,
520524 });
525+ assert.notInclude(JSON.stringify(loggedClaudeQueryOptions(options)), "secret launch prompt");
521526 });
522527 });
523528
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts+2−2
@@ -344,7 +344,7 @@ export interface ClaudeAgentSdkLoggedQueryOptions { · 343 unmodified lines
344344 readonly effort?: ClaudeAgentSdkQueryOptions["effort"];
345345 readonly includePartialMessages?: true;
346346 readonly pathToClaudeCodeExecutable?: ClaudeAgentSdkQueryOptions["pathToClaudeCodeExecutable"];
347− readonly extraArgs?: ClaudeAgentSdkQueryOptions["extraArgs"];
347+ readonly hasExtraArgs?: true;
348348 readonly allowDangerouslySkipPermissions?: true;
349349 readonly hasCanUseTool?: true;
350350 readonly hasEnvironment?: true;
@@ -436,7 +436,7 @@ export function loggedClaudeQueryOptions( · 85 unmodified lines
436436 ...(options.pathToClaudeCodeExecutable === undefined
437437 ? {}
438438 : { pathToClaudeCodeExecutable: options.pathToClaudeCodeExecutable }),
439− ...(options.extraArgs === undefined ? {} : { extraArgs: options.extraArgs }),
439+ ...(options.extraArgs === undefined ? {} : { hasExtraArgs: true }),
440440 ...(options.allowDangerouslySkipPermissions === true
441441 ? { allowDangerouslySkipPermissions: true }
442442 : {}),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t