4 ms·
This is the wrong answer. At a company I worked at, we had a well known saying: "Favor mechanisms over good intentions." As the saying went, if good intentions
by yowlingcat 6y ago
This is the wrong answer. At a company I worked at, we had a well known saying: "Favor mechanisms over good intentions." As the saying went, if good intentions worked, we "wouldn't need mechanisms."
The right answer here (as stated in sibling comments) is to install a mechanism into the build. A push that accidentally commits credentials should break the build. How it goes about doing that is up to you, but the specific way I've done that in the past is a git hook [1] specifically the pre-commit hook. It looks like there's a reasonably well-updated package by Yelp to help do this kind of thing [2].
[1] https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
[2] https://github.com/Yelp/detect-secrets https://github.com/Yelp/detect-secrets
- tialaramex 6y agoI agree with trying to build this, and with what you say about mechanism - but I don't agree it's step one. This is a prod, a reminder, it reminds people "Do the thing we trained you to do" but it's a mistake to rely on it without the accompanying policy about what they ought to do. These types of hook are brittle. If you already knew you were supposed to do it the way I wrote, you get a hook failure, you say "D'oh" and you do it properly. But if you aren't trained to do anything in particular, this type of hook is a behavioural branch. Maybe it's 0845, your mentor just arrived, the perfect time to ask what the diagnostic means. "You need to use a dedicated key store, let me show you" she says and you just learned an important thing. But maybe it's 1845, you're the last one in the office. You promised to raise a PR for tomorrow, but the hook fails. You try some things, and eventually discover that it hides well enough if split into four strings. You commit, click to raise the PR and go home. And the person who reads that PR will see immediately tomorrow it's unacceptable because it has an obfuscated API key, but alas if it's a real working key that's too late.
- yowlingcat 6y ago> But maybe it's 1845, you're the last one in the office. You promised to raise a PR for tomorrow, but the hook fails. You try some things, and eventually discover that it hides well enough if split into four strings. You commit, click to raise the PR and go home. You raise a great point which is that these kinds of mechanisms are only as strong as the cultures that support them. If the team doesn't wholeheartedly digest and commit to the new mechanism, it will at best achieve only surface level improvements. Getting your team's culture to that point is a step zero of sorts -- completely necessary precondition and you can't do much without it. And that can end up with people paying lip service to the letter but not spirit of the mechanism.