by bob1029 · 5y ago · 0 comments
For us, anything that would be a "secret" is stored in a SQLite database that sits next to the executable. In many cases, these secrets would additionally be encrypted with platform-specific techniques such as DPAPI. None of these databases are under source control and would be ignored upon commit.
If we want to load a secret into our application, we have to use an administrative web interface exposed by the application in each required environment. We view the management of secrets and other parameters as an important feature for our product and have built tooling up accordingly. Non-developers are able to manage secrets in our software, and we are actually trying to make this mandatory for compliance reasons.
We all know how to do it right, but particularly early on in a project it's easy to test something with a hardcoded API key, then forget and commit it.
Picking a framework that makes this a less obvious choice (e.g using a .env file that's already in gitignore by default) helps a lot here.
This would then allow other tools (e.g. git, GitHub, pre commit linters, frameworks) to flag this as a problem, either with a warning or an error, depending on the tool.
The idea is that then the novice/rushing expert is prevented from this easy to make mistake.
It will be easiest for developers in a hurry or without knowledge to simply copy and paste these third party strings.
(Pedantry is only required when writing their own software to generate bearer tokens, not even using a library or framework, and developers rarely do that, especially the kinds of things written in a rush.)
https://docs.github.com/en/github/authenticating-to-github/c...
Say you're deploying with cool-deploy-tool. cool-deploy-tool finds the password for the server by looking for a file called "Coolfile" in the project root. You have to create that file to use it. Now you have a footgun lying around.
I associate this stuff with the Ruby community, but it's spread far and wide, notably to the Node and Go communities, which i think have large Ruby emigrant populations.
As a prototypal example, consider dotenv, which began in Ruby:
https://github.com/bkeepers/dotenv
And has travelled to Node:
https://github.com/motdotla/dotenv
And Go:
It was a huge pain, it picked up nothing but false positives.
After a few months we decided that our pre-existing practices: have secrets passed to the app in environment variables which are set during deployment, and use fake secrets for test and dev, solved the problem in a much less painful way.
Is it so hard to keep real secrets separate from the source code?