Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussion] Support Docker Secrets #263

Open
sergioisidoro opened this issue Apr 3, 2023 · 2 comments
Open

[Discussion] Support Docker Secrets #263

sergioisidoro opened this issue Apr 3, 2023 · 2 comments

Comments

@sergioisidoro
Copy link
Contributor

I recently discovered that passing secrets to Docker containers is discouraged, and that is the reason Docker does not support out of the shelf mounting secrets into env variables:

Developers often rely on environment variables to store sensitive data, which is okay for some scenarios but not recommended for Docker containers. Environment variables are even less secure than files. They are vulnerable in more ways, such as:

(https://snyk.io/blog/keeping-docker-secrets-secure/)

I've been using a utility I made for a while in my Django projects to easily get Docker secrets with fallback to Env environment, and even supporting custom environ objects:

https://gist.github.com/sergioisidoro/7972229bb5826c25f12e7a406f11e7cd

I'm wondering if you would be willing to accept a PR which uses this wrapper for most sensitive stuff (Django secret key, DB password, etc)

@milesmcc
Copy link
Owner

milesmcc commented Apr 3, 2023

Thanks for starting this discussion. Is there some kind of standardized approach that we can fall back on? Perhaps some well-known library we could use? While your utility looks good and makes sense, it would be nice if there was a standardized approach used elsewhere in the ecosystem that we could lean on.

@sergioisidoro
Copy link
Contributor Author

Oh, thanks for pointing me in this direction. After re-searching for available solutions, it seems that Django envion now supports Docker style secrets since I made my little wrapper:

https://django-environ.readthedocs.io/en/latest/tips.html?highlight=docker#docker-style-file-based-variables

Would you be open to use Django environ. It's a bit opinionated tho, and might require a bit larger refactoring, but it's a good tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants