A functional security.txt file is composed of several key directives that provide essential context to a researcher. At its most basic level, the file must include a "Contact" field. This is typically a mailto: link to a dedicated security email address or a link to a secure web form or bug bounty platform. Providing a direct line of communication eliminates the friction that often prevents vulnerabilities from being reported.
Beyond a simple contact point, the RFC 9116 standard encourages the inclusion of several other fields to provide a comprehensive picture of the reporting environment. An "Expires" date is critical; it ensures that the information remains current and forces the organization to periodically review its security contact procedures. Without an expiration date, a researcher might attempt to contact an abandoned email address, leading to a false sense of security for the developer.
Other valuable fields include "Preferred-Languages," which helps bridge communication gaps between global researchers and local teams, and a "Canonical" link. The canonical field points to the authoritative URL of the security.txt file, preventing attackers from hosting fraudulent versions of the file on mirrors or development environments to redirect sensitive vulnerability reports to their own servers. For high-security environments, developers may also include a "Encryption" field, linking to a PGP key so that researchers can encrypt their reports before sending them over email.

The AI Builder’s Challenge: Navigating the SPA Routing Trap
The rise of AI builders—tools that generate code based on natural language prompts—has introduced a specific technical hurdle regarding the deployment of security.txt. Many AI-driven platforms default to building Single-Page Applications (SPAs) using frameworks like React, Vue, or Next.js. While these frameworks offer a smooth user experience, their routing logic can inadvertently break the delivery of static files.
In a typical SPA configuration, the server is often instructed to catch every incoming request and redirect it to the main index.html file. This allows the client-side JavaScript to handle navigation. However, if this configuration is not carefully managed, a request for /.well-known/security.txt will not return the plain text file the researcher is looking for. Instead, it will return the HTML of the application’s home page.
To a human researcher or an automated security scanner, this result is indistinguishable from a missing file. The scanner sees HTML tags where it expects plain text directives, leading to a failed check. When instructing an AI agent to build or update an app, developers must be explicit about how these static paths are handled. A prompt must not only request the creation of the file but also ensure that the hosting configuration—whether it be on Vercel, Netlify, AWS, or a traditional server—is set to serve the file as text/plain and bypass the global redirect logic.
Automation as a Safeguard in the Modern SDLC
