adhocteam / nytimes-library

A collaborative documentation site, powered by Google Docs.
https://nyt-library-demo.herokuapp.com/
Apache License 2.0
1 stars 1 forks source link

Investigate methods to securely pull secret credentials/variables to GAE #39

Closed ahinh43 closed 2 years ago

ahinh43 commented 2 years ago

Ideally we'd like to avoid baking sensitive information to our application deployment at rest. Is there a way to securely pull in environment variables and secrets to app engine's application securely?

Ideal solutions

gunsch commented 2 years ago

After some initial searching, I'm not seeing much that connects GAE to GCP secrets manager on startup for env variables. This might need to be a small Node startup script.

ahinh43 commented 2 years ago

I agree, I think we should also pursue the startup route. We'll essentially need these 2 things:

  1. A startup script that runs before the main library app that grabs secrets based on a prefix (i.e /production/content-library/OAUTH_CLIENT_ID) and sets it in the running app's environment variables
  2. IAM modifications to the GAE service account so it has permissions to access the secret manager API
gunsch commented 2 years ago

some starter Node code here: https://stackoverflow.com/questions/70435880/how-to-connect-google-app-engine-with-secret-manager-to-postgres

gunsch commented 2 years ago

Terraform changes for GAE service account: Role name: roles/secretmanager.secretAccessor In Dev, needs to go on content-library-development@appspot.gserviceaccount.com In Prod, needs to go on content-library-viewer@appspot.gserviceaccount.com

gunsch commented 2 years ago

45 did part of this

zenkimoto commented 2 years ago

49 also did part of this.

Would we call this ticket done?

gunsch commented 2 years ago

yes!