security.txt: what it is and how to add one to your site

Last updated

The short answer

security.txt is a small text file at yoursite.com/.well-known/security.txt that tells anyone who finds a security problem on your site how to report it to you. It must have two lines: Contact: (how to reach you) and Expires: (when the file should be checked again, ideally less than a year ahead). It is defined in RFC 9116, takes a few lines, and costs nothing.

Why a small business should have one

A template to copy

Replace the address and the dates, and save it as plain text named exactly security.txt:

Contact: mailto:security@yoursite.com
Expires: 2027-10-21T00:00:00.000Z
Preferred-Languages: en
Canonical: https://yoursite.com/.well-known/security.txt

Every line, explained

LineRequired?What it says
Contact:YesHow to report a problem: mailto: an address, a tel: number or an https link to a form. You can list more than one, most preferred first.
Expires:Yes, onceThe date after which the file is out of date. RFC 9116 recommends less than a year ahead.
Preferred-Languages:NoLanguages you can read reports in, such as en. English is assumed without it.
Canonical:NoThe file's own address, so a copy found elsewhere can be checked.
Policy:NoA link to a page explaining how you handle reports.
Encryption:NoA link to a key people can use to send you encrypted reports.
Acknowledgments:NoA link to a page thanking people who reported problems.

Any web link in these lines must start with https://. The standard also recommends signing the file with an OpenPGP signature; that is optional for most small businesses.

Where it goes, and how to add it

  1. Put the file in a folder named .well-known at the top of your site, so it loads at https://yoursite.com/.well-known/security.txt. On WordPress and most hosting, create the folder with your host's file manager or FTP, next to your homepage files.
  2. It must load over https, as plain text (text/plain, UTF-8). A copy at yoursite.com/security.txt is allowed for older tools, but the .well-known one is the one that counts.
  3. Open the address in a browser and check the text appears, not a "page not found" page.
  4. Hosted builders may not let you create files in .well-known; check your platform's help.

It sits alongside your other security settings: see the security headers guide.

Common mistakes

Checklist

Questions people ask

Is security.txt required?
No law requires it, but it is a published standard (RFC 9116), widely used, and security scanners, including ours, look for it. It takes one small file.
Will security.txt attract hackers?
It publishes a contact, nothing about your systems. Use a monitored role address, such as security@yoursite.com, rather than a personal one.
Which email address should I use?
One that someone checks and that keeps working when staff change, such as security@ forwarding to the owner and whoever runs the site. A contact form address works too.
What happens when the Expires date passes?
The file should be treated as out of date, so readers may not trust the contact details. Put a reminder in your calendar to update the date before it arrives.

What the free scan checks for this

These are the FocalScore checks that cover this guide's subject. Each one in your report says what it found, shows the evidence and gives the fix.

Sources

Last checked . Documentation, settings and rules change; if one of these pages now says something different, it is right and this guide is out of date. Tell us at info@focalscore.com.

  1. RFC 9116: A File Format to Aid in Security Vulnerability Disclosure
  2. OWASP Cheat Sheet: HTTP security response headers
  3. Google Search Central: Introduction to robots.txt