-
Notifications
You must be signed in to change notification settings - Fork 95
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
remove secrets from config yaml and terraform configuration files #720
Conversation
Further thoughts on this with respect to breakage of schema compatibility. Currently the schema sets client_id/client_key for a number of different auth use-cases. With the current approach we would have to remove these from the schema (breaking backwards compatibility) and in each case document the env variable that needs to be set in order to define the appropriate terraform variable. We could alternatively use a convention whereby the current fields are filled with a placeholder value instead of the current key. For example:
The above convention would trigger a search for the env variables google_oauth_client_id and google_oath_client_secret and would use them to set TF_VAR_google_oauth_client_id etc which then populates the corresponding terraform variables. This approach prevents schema breakage and could likely be backwards compatible with the current implementation of storing secrets (if we wish to continue to support that). It seems a hacky though... For now I will continue to implement this with schema modification... |
So @costrouc pointed out that it is not just .tf files that the secrets are exposed in during the render. Sometimes it is put in other files that won't work as cleanly as we had envisaged. So for example, the auth client_id and client_key are leaked via the jupyterhub config:
Until we implement something more systematic for secrets management it seems like avoiding rendering these values is too challenging and if security is the imperative on a CI provider based deployment the best option is to simply not render. |
That's true, that those SECRETS are engrained in the files. My thought was to have placeholders in those files and and replace them in terraform during deployment via terraform variables, in here: |
6487857
to
56a11c4
Compare
This implements both approaches based on the two use-cases:
@aktech's suggested is a nice addition to this PR.. .namely, we implement a extra bit of logic to replace the QHUB_SECRET placeholder after rendering (so we don't leak secrets there) but before the relevant file is provided to terraform. This may have to be implemented on a case by case basis because the relevant values might be in any file... or perhaps we could search every file for the placeholder patterns... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mostly pointed out some nitpicks, overall looks good to me. I will take another look if you have time to address the comment here
I can then review get_secret_config_entries
and it's helper functions more closely.
Sorry about the style issues. Fixed now. Tests for the get_secret_config_entries function are in tests/test_render.py or did you mean that I should add more? |
Awesome, thanks!
Yep, I missed it apologies. Taking a look now. |
8e6ec1e
to
9a56ad9
Compare
This looks great now. One last thing, can you add some documentation, maybe here. |
Looks great, thanks for working on it! |
Resolves #13.
Proposal for managing secrets... this approach:
TF_VAR_