Articles
Published · November 18, 2026

security.txt: Write the Plain-Text File Researchers Look For

A security.txt is a short plain-text file at /.well-known/security.txt. Here is how to write one that follows RFC 9116, with a full example and the common fixes.

Also in: Español中文हिन्दी

A security.txt is a small plain-text file, served at /.well-known/security.txt, that tells security researchers how to reach you. RFC 9116 defines it, and only two fields are required: Contact and Expires.

Quick answer

Create a UTF-8 text file with at least one Contact: line and one Expires: line, then serve it over HTTPS at https://your-domain/.well-known/security.txt. That's the whole requirement. Everything else, a policy link or an encryption key for example, is optional.

The idea started as an Internet Draft submitted by Edwin Foudil in September 2017, and the IETF published it as RFC 9116 in April 2022, according to Wikipedia's security.txt entry. It is similar in spirit to robots.txt: a predictable path, a simple syntax, readable by people and by scripts.

Step-by-step

Create the file at the well-known path

The RFC says organizations must place the file under the /.well-known/ path, for example https://example.com/.well-known/security.txt, and that access must use HTTPS. A top-level /security.txt is the older location. securitytxt.org says it can serve as a fallback, and that the file may live in both places. If both exist, the /.well-known/ copy is the one researchers should use.

The file applies only to the host it is served from. A file on example.com does not cover shop.example.com or a parent domain, so each host that needs one gets its own.

Save it as UTF-8 plain text

The file is text/plain with a utf-8 charset, and lines end in CRLF or LF. Any text editor can write it. If your contact names or comments include non-ASCII characters, UTF-8 and line breaks are the two things to check before you upload it. Lines starting with # are comments.

Add Contact

Contact is required, and it can repeat. Each value is a URI: mailto:, tel:, or an https:// link such as a web form. When you list several, the order is your priority order, so put the preferred channel first.

Contact: mailto:security@example.com
Contact: https://example.com/report-a-vulnerability

Use a mailbox someone actually reads. A contact that bounces is worse than none.

Set Expires

Expires is also required, and it must appear exactly once. The value is a date and time in the ISO 8601 style the RFC takes from RFC 3339, for instance 2027-06-30T23:59:59Z. The RFC recommends choosing a date less than a year ahead so the file does not go stale.

Expires: 2027-06-30T23:59:59Z

The RFC takes staleness seriously. It says having no security.txt may be preferable to having one with stale information.

Add optional fields

Everything below is optional, so add only what you can keep accurate.

  • Policy: an https:// link to your disclosure policy. This is where rules for testing belong.
  • Acknowledgments: a link to a page thanking past reporters.
  • Encryption: a link to your public key. Never paste the key itself into the file; the value is a URI such as https:, dns:, or openpgp4fpr:.
  • Preferred-Languages: a comma-separated list of language tags, such as en, es. It may appear only once, and English is assumed if you omit it.
  • Canonical: the URI of the file itself. It can repeat if the file is served from several addresses.
  • Hiring: a link to your security job openings.

Web links in these fields must begin with https://.

Put it together

# Our security contact
Contact: mailto:security@example.com
Contact: https://example.com/report-a-vulnerability

# Disclosure rules and thanks
Policy: https://example.com/security-policy
Acknowledgments: https://example.com/hall-of-fame

# Public key and language
Encryption: https://example.com/pgp-key.txt
Preferred-Languages: en, es

# Where this file lives
Canonical: https://example.com/.well-known/security.txt

Expires: 2027-06-30T23:59:59Z

Sign it (optional, recommended)

RFC 9116 recommends signing the file with an OpenPGP cleartext signature so researchers can confirm it is authentic and was not planted by an attacker. If you sign, include Canonical so the signature also vouches for the file's location. Researchers still need to check the signing key themselves, so link your key with Encryption or your policy page.

Common problems and fixes

  • The date has passed. Put the renewal date in a calendar or a note the day you publish. An expired file tells researchers the information may be wrong.
  • The server returns HTML or the wrong [media type](/articles/text-markdown-media-type-rfc-7763-registers). Request the URL and confirm it comes back as text/plain.
  • It redirects to HTTP. The file must be reached over HTTPS, and so must the links inside it.
  • A subdomain has no file. The file does not cascade, so publish one per host that needs it.
  • Two `Expires` or two `Preferred-Languages` lines. Both fields may appear only once.
  • The file is large. The RFC warns parsers may decline files over 32 KB, fields over 2,048 characters, or more than 1,000 lines. A real security.txt is nowhere near that size.
  • Researchers assume they may test. The RFC says the file's presence should not be read as permission to test. If you want to allow or limit testing, say so in the page your Policy field points to.

Doing this with Carets

A security.txt is a good fit for Carets because it is a short plain-text file you keep and revisit. Carets is a native editor for iPhone, iPad, and Mac that handles plain text, Markdown, and code, so you can draft the file, check each field against the RFC, and keep it as plain text you can upload anywhere.

Two features help here. Syntax highlighting makes comment lines and field names easy to scan in config-style files. Files, projects, and tags let you keep the file in a "site files" project next to your policy page draft, and a note tagged with the Expires date gives you a renewal reminder you will find again. Because the files stay plain text, they are portable and future-proof.

Download Carets on the App Store for iPhone, iPad, and Mac

Frequently Asked Questions

Is security.txt required?

No law and no part of the RFC forces a site to publish one. RFC 9116 is an Informational document, and the file is a convention that helps researchers find the right contact. If you do publish one, Contact and Expires are required inside it.

Where does security.txt go?

At /.well-known/security.txt, served over HTTPS. A top-level /security.txt is the legacy location, and if both exist the well-known copy is the one to use.

How far ahead should Expires be?

The RFC recommends less than a year into the future, so the file does not go stale. Set a reminder for the date and renew the file before it arrives.

Does security.txt give researchers permission to test my site?

No. The RFC says the file's presence should not be read as permission. Put the rules for testing in the policy page that the Policy field links to.

Do I have to sign the file?

No, but RFC 9116 recommends an OpenPGP cleartext signature, together with a Canonical field, so researchers can check that the file is authentic.