The other day I was trying to prevent my pi.dev coding harness to expose my API keys in the env variable to the remotely hosted LLM. This is a chicken and egg problem. Without the API keys the underlying commands run by agents don't work. I notice that many of the open weights model especially Qwen 3.6 blindly runs env command and blindly exposes all the env vars. How do we deal with this. This has nothing to do with this security incident but this is how it all starts.
There's ways to make sure env vars get only injected at runtime and arent easily accessible otherwise or to even make them inaccessible to the user your agent is running on, and for you to manually run the code with the right permissions when the keys actually need to be used. Almost nobody bothers doing it though.