I have a Django app that uses some secret keys (for example for OAuth2 / JWT authentication). I wonder where is the right place to store these keys.
Here are the methods I found so far:
- Hardcoding: not an option, I don't want my secrets on the source control.
- Hardcoding + obfuscating: same as #1 - attackers can just run my code to get the secret.
- Storing in environment variables: my
app.yaml
is also source-controlled. - Storing in DB: Not sure about that. DB is not reliable enough in terms of availability and security.
- Storing in a non-source-controlled file: my favorite method so far. The problem is that I need some backup for the files, and manual backup doesn't sound right.
Am I missing something? Is there a best practice for storing secret keys for Django apps or App Engine apps?