Unfortunately, with secrets in the OS env, you‘re one `printenv` or improperly written third party dependency that leaks env vars away from a security incident.
The env and more importantly what populates it should be secure, but security works best in layers. Sanitizing the env after loading it is a nicer middleground, k8s-style secrets materialized to files work best and are conceptually close enough to the OS env.
> you‘re one `printenv` or improperly written third party dependency that leaks env vars away from a security incident.
Game over already if anyone can run commands or arbitrary code. Not using the environment won't help you.
It's not my intuition that materializing secrets to files is a better way to protect them than just injecting them into the environment, where they don't persist.