Repository navigation
fix(security): every citizen-facing spawn strips credential-shaped variables — the snippet runner inherited the core environment like the shell did - #4057
Merged
Conversation
…riables — the snippet runner (python3 / rustc / the built program) inherited the core's environment like the shell did Card f25f4141 (BigMama, 2026-09-15): the core is started with `set -a; . config.env`, so HF_TOKEN sits in its ambient environment; Rust's Command inherits it by default. #3786 (2026-09-06) put the strip on the citizen SHELL. `commands/code/run` spawns python3, rustc and the compiled program the same way, without it — a snippet reading `os.environ` / `std::env::vars()` is as ordinary as a shell running `env`, and tool output is quoted into rooms by design. One strip, one place: `shell_session::strip_secret_env(cmd)` (the loop that was inline at the shell spawn), applied at all four spawn sites. Test: a Rust snippet run through code/run sees None for a TOKEN-named variable set in the parent and the value of an ordinary one. The floor — secrets never sourced into the core's ambient environment — stays on the card (install-service.sh); this is the net above it, now with no hole. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
What
One strip, one place:
shell_session::strip_secret_env(cmd)(the loop that was inline at the citizen shell spawn since #3786) is now applied at every citizen-facing spawn — the shell, and the snippet runner's python3, rustc and compiled program incommands/code/run.Test: a Rust snippet run through code/run sees
Nonefor a TOKEN-named variable set in the parent process and the value of an ordinary one.Why
Card f25f4141 (BigMama, 2026-09-15): the core is started with
set -a; . config.env, so HF_TOKEN sits in its ambient environment and Rust'sCommandinherits it by default. The shell had the net; the snippet runner did not, and a snippet readingos.environ/std::env::vars()is as ordinary as a shell runningenv, with tool output quoted into rooms by design.The floor (secrets never sourced into the core's ambient environment) stays on the card; this closes the hole in the net.
Acceptance
code/runwithlang: python, codeimport os; print(os.environ.get("HF_TOKEN"))on a node whose config.env defines HF_TOKEN printsNone.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo