Expand description
Which environment variables agent-supplied code may see.
Two different questions live here, and they want opposite shapes:
-
What does a child process inherit? (
child_env_allowed) We are choosing what to hand over, so an allowlist is right. A denylist here has to enumerate every secret name in the ecosystem and loses the moment a new one appears - which is exactly what happened: the MCP spawner’s substring denylist passedAWS_SECRET_ACCESS_KEY(it matches neitherAPI_SECRETnorSECRET_KEY),GITHUB_TOKEN,NPM_TOKEN,DATABASE_URL, and Leviath’s ownLEVIATH_API_TOKEN. -
May a script read this named variable? (
is_sensitive_env_name) A script asks for one name it already knows. An allowlist cannot work - no fixed list covers every legitimate variable a provider script might read - so the rule inverts: anything that looks like a credential is refused unless the user allowlisted it, and everything else is fine.
Neither is a substitute for the other, and both are shared rather than reimplemented per call site so a gap gets fixed once.
Functions§
- child_
env_ allowed - Whether a spawned child process may inherit
name. - constant_
time_ eq - Compare two secrets without leaking their contents through timing.
- is_
secret_ header - Whether a header’s value must be redacted before it is logged.
- is_
sensitive_ env_ name - Whether
namelooks like it holds a credential. - redact
- Render a secret for display, showing only its last four characters.
- script_
env_ allowed - Whether a script may read
name, given the user’s[security] allow_env_vars.