Skip to content

0.1.2: hide the provider API key from the agent's shell - #3

Merged
coderbuzz merged 1 commit into
mainfrom
fix/scrub-api-key
Oct 12, 2026
Merged

coderbuzz merged 1 commit into
mainfrom
fix/scrub-api-key

Conversation

@coderbuzz

Copy link
Copy Markdown
Owner

The bash tool spawned its shell with process.env plus the settings env, so DEEPCODE_API_KEY (and the prefix-stripped API_KEY) were visible to the model. Verified on the real API before the change: env | grep -c DEEPCODE_API_KEY run by the agent returned 1. Anything it printed lands in tool output, the JSON result and orchestrator logs.

  • Vendor patch scrub-api-key.patch: buildShellEnv drops DEEPCODE_API_KEY, DEEPCODE_PLUS_API_KEY and the stripped API_KEY/PLUS_API_KEY. Other variables, including the user's own *_API_KEY, pass through.
  • e2e test (red before the patch) plus a real-API check: agent bash now sees 0, dsh still authenticates.
  • The timeout test polled once and could race the SIGKILL; it now polls up to 2s.
  • Version 0.1.2. After merge, tag v0.1.2 publishes through Trusted Publishing.

This does not stop an agent with file access from reading ~/.config/tencent-dev/deepseek.env; for untrusted content keep using a container without the token.

🤖 Generated with Claude Code

buildShellEnv copied process.env and the settings env into every bash
call, so DEEPCODE_API_KEY (and the prefix-stripped API_KEY) were visible
to the model. Anything it printed ended up in tool output, the JSON
result and orchestrator logs. Strip them (vendor patch scrub-api-key).

Also make the timeout test poll for the killed child instead of racing it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderbuzz
coderbuzz merged commit 8293c74 into main Oct 12, 2026
1 check passed
@coderbuzz
coderbuzz deleted the fix/scrub-api-key branch October 12, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant