Skip to content

fix(security): every citizen-facing spawn strips credential-shaped variables — the snippet runner inherited the core environment like the shell did - #4057

Merged
joelteply merged 1 commit into
canaryfrom
fix/every-citizen-spawn-strips-credentials
Sep 15, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/every-citizen-spawn-strips-credentials

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

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 in commands/code/run.

Test: a Rust snippet run through code/run sees None for 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's Command inherits it by default. The shell had the net; the snippet runner did not, and a snippet reading os.environ / std::env::vars() is as ordinary as a shell running env, 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/run with lang: python, code import os; print(os.environ.get("HF_TOKEN")) on a node whose config.env defines HF_TOKEN prints None.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…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
@joelteply
joelteply merged commit efe8d1a into canary Sep 15, 2026
5 checks passed
@joelteply
joelteply deleted the fix/every-citizen-spawn-strips-credentials branch September 15, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant