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
497 env: {497 env: {
498 ANTHROPIC_API_KEY: "secret",498 ANTHROPIC_API_KEY: "secret",
499 },499 },
500 extraArgs: {
501 "append-system-prompt": "secret launch prompt",
502 },
500 canUseTool: (_toolName, input, callbackOptions) =>503 canUseTool: (_toolName, input, callbackOptions) =>
501 Promise.resolve({504 Promise.resolve({
502 behavior: "allow",505 behavior: "allow",
@@ -517,7 +520,9 @@ describe("ClaudeAdapterV2 native protocol logging", () => { · 14 unmodified lines
517 cwd: "/workspace",520 cwd: "/workspace",
518 hasCanUseTool: true,521 hasCanUseTool: true,
519 hasEnvironment: true,522 hasEnvironment: true,
523 hasExtraArgs: true,
520 });524 });
525 assert.notInclude(JSON.stringify(loggedClaudeQueryOptions(options)), "secret launch prompt");
521 });526 });
522});527});
523 528
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts+2−2
@@ -344,7 +344,7 @@ export interface ClaudeAgentSdkLoggedQueryOptions { · 343 unmodified lines
344 readonly effort?: ClaudeAgentSdkQueryOptions["effort"];344 readonly effort?: ClaudeAgentSdkQueryOptions["effort"];
345 readonly includePartialMessages?: true;345 readonly includePartialMessages?: true;
346 readonly pathToClaudeCodeExecutable?: ClaudeAgentSdkQueryOptions["pathToClaudeCodeExecutable"];346 readonly pathToClaudeCodeExecutable?: ClaudeAgentSdkQueryOptions["pathToClaudeCodeExecutable"];
347 readonly extraArgs?: ClaudeAgentSdkQueryOptions["extraArgs"];347 readonly hasExtraArgs?: true;
348 readonly allowDangerouslySkipPermissions?: true;348 readonly allowDangerouslySkipPermissions?: true;
349 readonly hasCanUseTool?: true;349 readonly hasCanUseTool?: true;
350 readonly hasEnvironment?: true;350 readonly hasEnvironment?: true;
@@ -436,7 +436,7 @@ export function loggedClaudeQueryOptions( · 85 unmodified lines
436 ...(options.pathToClaudeCodeExecutable === undefined436 ...(options.pathToClaudeCodeExecutable === undefined
437 ? {}437 ? {}
438 : { pathToClaudeCodeExecutable: options.pathToClaudeCodeExecutable }),438 : { pathToClaudeCodeExecutable: options.pathToClaudeCodeExecutable }),
439 ...(options.extraArgs === undefined ? {} : { extraArgs: options.extraArgs }),439 ...(options.extraArgs === undefined ? {} : { hasExtraArgs: true }),
440 ...(options.allowDangerouslySkipPermissions === true440 ...(options.allowDangerouslySkipPermissions === true
441 ? { allowDangerouslySkipPermissions: true }441 ? { allowDangerouslySkipPermissions: true }
442 : {}),442 : {}),

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