by runnerup · 4y ago · 0 comments
How would you avoid that?
Even this article, which recommends keeping your secrets in environment variables, tells you to implement that by storing them in the filesystem. The advice isn't to avoid storing your secrets in the filesystem; it's to avoid storing them in version control.
It is apparently an exercise for the reader to figure out why it's better to read your secrets out of the environment, which read them from a file you provided, than to read them from your own file yourself.
export DATABASE_URL="$(bw get password my_app/db_url/prod)"
And put that in a startup script (that can go in version control).If you can call bitwarden from within the python code somehow, such as with subprocess, that would be better.
For the desktop, use the keyring module.
If you start to scale up your threat model, you should use a vault, but the setup is way more costly, and tricky to get the reboot story right (hence the priviledged first requests comments).
I've always accepted this was an attack vector, and some malicious library could extract env vars.
This actually makes a lot of sense, thanks!