How to Create a security.txt File for Your Website

Create a security.txt file for your website using RFC 9116. Learn where it belongs, what Contact and Expires mean, and how to validate deployment.
What is security.txt?
security.txt is a plain-text file that tells security researchers how to report vulnerabilities to an organization. It is intended to make disclosure channels easier to find. It does not prove that a site is secure, create a vulnerability disclosure program by itself or replace a published security policy.
Where should the file live?
RFC 9116 specifies the /.well-known/security.txt path for web-based services. The file should be served over HTTPS with a text/plain content type and UTF-8 encoding. A legacy root-level /security.txt file may be used for compatibility, but the well-known location is the one specified by the RFC. See the official RFC before deployment.
Important fields
The Contact field is required and gives researchers a way to report a vulnerability, such as a mailto: address or HTTPS contact page. Expires indicates when the file should be considered expired. Canonical identifies the canonical URI for the file. Other fields, such as Policy, Acknowledgments, Preferred-Languages and Encryption, can provide additional information when applicable. Follow RFC 9116 for syntax and field semantics.
Example security.txt
A minimal illustrative file could look like this:
Contact: mailto:[email protected]
Expires: 2027-12-31T23:59:00Z
Canonical: https://example.com/.well-known/security.txt
Replace the example address and domain with contact details that your organization actually monitors. Do not publish an address that is not authorized to receive security reports.
Deploy on a static website
Create a .well-known directory in the site’s public output and place security.txt inside it. Confirm that the deployed URL returns the file, that HTTPS works and that the response uses a plain-text content type. On static hosting, check how your build copies dot-directories and whether a routing rule rewrites the path.
Validate and maintain it
Open the exact public URL in a browser or inspect the response headers with a command-line HTTP client. Confirm that the Contact destination works and that the Expires date is in the future. Assign an owner to renew the file before it expires. A stale contact channel can be worse than no useful disclosure information because researchers may believe a report has been delivered when it has not.