Security adoption is a developer experience problem

April 5, 2024

Key takeaway: Put security checks inside the pull request and other places developers already work, so the tools stay turned on.

Developers route around security checks that get in their way, so put the checks where developers already work and make the fixes teach.

Most of the code you ship isn’t yours. Run npm ls --all on a mid-sized app and watch it scroll. Log4Shell made that concrete in December 2021, when plenty of teams spent a week learning they ran Log4j at all. Last week, a backdoor turned up in xz Utils, planted by a contributor who spent years earning trust and caught because one engineer noticed SSH logins were slow. Those dependencies are staying, so you have to live with them safely, and that includes reporting what you find, sending fixes upstream, and paying for what your business runs on.

Traditional security reaches developers as friction: a gate right before release, a nightly scanner filing 400 findings into another team’s tracker, a pen test PDF about code that’s already been rewritten. People don’t ignore those out of malice. They have a deadline.

So shift left. Findings show up in the pull request on the changed lines. Vulnerable dependencies arrive as a version-bump PR. Secret scanning blocks the push before the key leaves the laptop.

GitHub’s code scanning autofix suggests a fix in the PR and explains why the code was vulnerable. Given this:

User.where("email = '#{params[:email]}'")

it suggests User.where(email: params[:email]). A developer who only gets the patch writes the same query next week. One who learns that the hash form lets ActiveRecord bind the value as a parameter usually stops writing it.

Judge the program by adoption, not finding counts: how many repos have scanning on, how long findings sit open, and how many get dismissed as noise. A scanner that’s on and trusted protects more code than a stricter one everyone works around.