The one file that makes shakedown artists move on
Every other fix on this blog closes a hole. This one is different: it doesn't patch anything. It just gives the person who finds your next hole a reason to email you quietly instead of dumping it publicly — or demanding money for it.
Put yourself in the shoes of someone who just noticed a real problem on your site. Maybe a friendly developer, maybe not. They want to tell you — but there's no security contact anywhere, no obvious inbox, just a generic hello@ that may or may not be read. So they're left with two bad options: post it publicly and hope that gets your attention, or lean on you for a “reward” before they'll say what it is.
A security.txt file removes that fork in the road. It's a tiny plain-text file at a standard location that says, in effect, “here's exactly where to send security reports.” With a channel that obviously exists, the quiet heads-up becomes the easy path — and the shakedown email starts to look like more effort than it's worth.
What it actually signals
The file does two jobs at once, and the second one is the underrated part:
It gives real researchers a door
Legitimate security folks look for security.txt first — it's the recognized convention (RFC 9116). A clear Contact: line means their report lands in the right inbox instead of evaporating, so they actually bother to send it.
It tells the opportunist you're not an easy mark
The mass-emailed shakedown works on volume and on the assumption that you're unmanaged and easily rattled. A site that publishes a proper disclosure channel reads as the opposite: someone who's seen this before and has a process. That's exactly the profile a low-effort grifter skips in favor of the next target.
The exact file to ship
There's no framework and no build step here — it's a text file. At minimum you need a Contact: and an Expires: line. Paste this, swap in your details:
Contact: can be an email, a form URL, or both (add a second Contact: line). Expires: is required by the spec — set it a year out so the file can't rot into a dead address forever. Everything else (Encryption: for a PGP key, Policy: for your disclosure terms) is optional polish.
Where it goes
- 1
Put it at /.well-known/security.txt.
The canonical location ishttps://yourdomain.com/.well-known/security.txt. That's the path scanners and researchers check first. A copy at the root (/security.txt) is allowed as a fallback, but the.well-knownpath is the one that counts. - 2
Serve it as plain text over HTTPS.
It should return200withcontent-type: text/plain. Most static hosts serve files from apublic/directory — drop it inpublic/.well-known/security.txtand it ships as-is. No route handler needed. - 3
Point it at an inbox someone reads.
This is the part that makes it real. Asecurity@address nobody checks is worse than none — it looks responsive and isn't. Route it to wherever you'll actually see it, and put the expiry on your calendar so you renew before it lapses.
Be honest about what this is
This is not a vulnerability fix, and we won't pretend it is. If your .env is public or a live key is in your bundle, fix that first — a disclosure address on a leaking site just tells people where to send the bad news. Think of security.txt as hygiene and signaling: it lowers the odds that an honest finding turns into a public mess or a ransom note. Cheap to add, and it changes the tone of the conversation before it even starts.
One text file, one inbox, five minutes — and the next person who finds something on your site has a reason to just tell you.
Want to know if your security.txt is present and valid — along with everything a shakedown artist would probe first? Scan in about 20 seconds.