fix: filter LLM API keys from bash tool child env#128
Open
Darkroom4364 wants to merge 1 commit intoPwnKit-Labs:mainfrom
Open
fix: filter LLM API keys from bash tool child env#128Darkroom4364 wants to merge 1 commit intoPwnKit-Labs:mainfrom
Darkroom4364 wants to merge 1 commit intoPwnKit-Labs:mainfrom
Conversation
Contributor
Darkroom4364
commented
Apr 12, 2026
- Adds sanitizedEnv() to strip sensitive keys before passing to execSync
- Keeps PATH, HOME, TARGET, and auth env vars
Darkroom4364
commented
Apr 12, 2026
Contributor
Author
Darkroom4364
left a comment
There was a problem hiding this comment.
Good change, a few things:
Bug — missed call site (line ~1496)
The interactive shell session (create action) builds its env as { TARGET: …, ...this.buildAuthEnvVars() } — no sanitizedEnv(), so it inherits process.env via Node defaults and leaks every key this PR tries to strip.
Missing patterns
MISTRAL_API,COHERE_API,HUGGINGFACE,DEEPSEEK_API,TOGETHER_API,GROQ_API— all common in the wild._KEY/_SECRETsuffix catch-all would be more future-proof than an allowlist of prefixes.
Nit
sanitizedEnv() rebuilds the filtered object on every call. Fine for now, but a module-level lazy cache would be free and cleaner.
Overall: scope is right (only tools.ts), diff is minimal. Fix the second call site and widen the patterns, then LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.