Developer finds --safe-mode flag left API keys fully exposed to subprocess calls
A developer discovered that adding the --safe-mode flag to Claude CLI subprocess calls in their project did not prevent sensitive API credentials from being inherited by child processes. The flag only controls config and plugin discovery, not environment variable inheritance, meaning both a GitHub token with full repository write access and a DEV.to API key were silently passed to every spawned subprocess. This occurred because Python's subprocess module copies the parent process's entire environment by default when no explicit env= argument is provided. The credentials had been loaded into os.environ at startup via a load_env() function, making them available process-wide despite the subprocess having no legitimate need for them. The developer confirmed the exposure through a minimal reproduction script that verified both keys were visible to a stand-in process whose sole task was generating a one-line commit message.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in