security.txt: publishing a security contact
The security.txt format defined in RFC 9116: where the file must be served, the two required fields Contact and Expires, the optional fields, signing, and the scope of a single file.
Type: ReferenceVersionRFC 9116Someone who finds a vulnerability in a website needs to know whom to tell. security.txt answers that in a fixed place and a fixed format, so that the answer can be found by a person or a script without searching the site. The format is defined in RFC 9116, published in April 2022 by Edwin Foudil and Yakov Shafranovich as an Informational RFC, and the name security.txt is registered in the IANA Well-Known URIs registry.
| Location | /.well-known/security.txt |
|---|---|
| Scheme | HTTPS only |
| Content-Type | text/plain; charset=utf-8 |
| Required fields | Contact (one or more) and Expires (exactly one) |
| Line endings | CRLF or LF |
| Comments | Lines beginning with # |
| Signature | OpenPGP cleartext signature recommended |
A complete file
# Security contact for example.com
Contact: mailto:security@example.com
Contact: https://example.com/security/report
Expires: 2027-11-30T23:59:59Z
Encryption: https://example.com/.well-known/pgp-key.txt
Preferred-Languages: en, ko
Policy: https://example.com/security/policy
Acknowledgments: https://example.com/security/thanks
Canonical: https://example.com/.well-known/security.txt
Hiring: https://example.com/careers/securityOnly the two Contact lines and the Expires line are required. The first Contact is the preferred channel and the second is the fallback, because RFC 9116 asks for contacts to be listed in order of preference.
Fields
Field names are case-insensitive, and each field takes one value on its own line. A field may appear more than once unless its definition says otherwise. Researchers are required to ignore fields they do not support, so new fields registered with IANA do not break older readers.
| Field | Required | Repeatable | Value |
|---|---|---|---|
| Contact | Yes | Yes, in order of preference | A URI: mailto: for email, tel: for telephone, or a web page beginning with https://. RFC 9116 recommends encryption when the contact is an email address. |
| Expires | Yes | No | The date and time after which the file should be considered stale, in RFC 3339 format. RFC 9116 recommends a value less than a year in the future. |
| Encryption | No | Yes | A URI where a key for encrypted reports can be retrieved, such as an https:// URL, a dns: OPENPGPKEY record or an openpgp4fpr: fingerprint. The key itself must not appear in the field. |
| Acknowledgments | No | Yes | An https:// page that recognizes researchers who reported vulnerabilities. |
| Preferred-Languages | No | No | Comma-separated language tags, such as en, ko. The order does not express priority. Without the field, researchers may assume English. |
| Canonical | No | Yes | The https:// URIs at which this file is published. If the URI the file was fetched from is not listed, the RFC says its contents should not be trusted. |
| Policy | No | Yes | An https:// link to the vulnerability disclosure policy. |
| Hiring | No | Yes | An https:// link to security-related job openings. |
Serving the file
Section 3 of the RFC is strict about delivery. The file must be placed under /.well-known/, must be fetched over HTTPS, and must be served as text/plain with the charset parameter set to utf-8. A copy at the old location, /security.txt, is allowed for compatibility, either as a file or as a redirect to the /.well-known/ version; if both exist, the /.well-known/ file wins. Where site files live: the root path and /.well-known/ explains the /.well-known/ prefix, and serving site files: media types, encoding and status codes shows how to check the headers a server sends.
curl -sI https://example.com/.well-known/security.txt | grep -i '^content-type'
curl -s https://example.com/.well-known/security.txtA file applies only to the host it was fetched from. The file at example.com does not cover www.example.com or shop.example.com, and a file on a subdomain does not cover its parent domain. An organization with several hosts publishes a file on each, which is where the Canonical field and a signature help: one signed file can list every location it is published at. A file may also say that it applies to the organization's products and services, and the RFC suggests using the Policy page to describe the scope in detail.
Signing
RFC 9116 recommends signing the file with an OpenPGP cleartext signature, as defined in RFC 4880, and including a Canonical field when it is signed, so that the signature also vouches for the file's location. The signed file starts with a -----BEGIN PGP SIGNED MESSAGE----- line, the fields follow unchanged, and the signature block comes last. Verifying that the signing key is genuine is left to the researcher; the key named in Encryption is not necessarily the one used to sign.
Keeping it current
Expires is the field that most often goes wrong, because nothing reminds a site to change it. A file past its expiry date tells researchers that its contacts may no longer work. Treat the date as a review deadline: before it arrives, confirm that every Contact still reaches someone, then move Expires forward and re-sign the file if it is signed. The securitytxt.org site, created by the format's authors, offers a form that builds a file with these fields.
See also
- Where site files live: the root path and /.well-known/Clients find machine-readable site files at fixed addresses: some at the root of each host, some under the /.well-known/ prefix of RFC 8615, and some inside every page. Where a file sits also decides which URLs it can speak for.
- Serving site files: media types, encoding and status codesWhich Content-Type each machine-readable file should be served with, why UTF-8 matters, and how crawlers react to redirects, client errors and server errors when they request robots.txt.
- Machine-readable files a website can publishThe files and markup a site publishes for crawlers, search engines, language model tools and security researchers: what each one is for, where it lives and which document defines it.
- Publishing JSON files: media type, encoding and parsingThe rules a published JSON file has to follow under RFC 8259, how to serve it over HTTP, and how to write, read, format and validate it with Python's json module without producing output that other parsers reject.
References
- Foudil, E. and Shafranovich, Y. RFC 9116: A File Format to Aid in Security Vulnerability Disclosure. IETF, April 2022 rfc-editor.org
- Well-Known URIs registry. IANA iana.org
- security.txt. securitytxt.org securitytxt.org
- RFC 8615: Well-Known Uniform Resource Identifiers (URIs). IETF, May 2019 rfc-editor.org
- RFC 4880: OpenPGP Message Format, section 7 (cleartext signature framework). IETF, November 2007 rfc-editor.org