PorchLight

Setup

Add three things to your site: a header, the notice text, and a security.txt field. Unknown paths also have to return 404, or the check can't work.

What to add

Send this header on every response:

Security-Testing: not-authorized; check="/.well-known/security-testing/"

Put the notice text, word for word, in an HTML comment at the top of each page and as visible text on error pages:

<!-- Security testing of this site is not authorized: no tester's check
has been published under /.well-known/security-testing/. The tester picks
two random values of at least 128 bits each; the owner publishes the second
at the address named by the first. Only a 200 whose first line is the second
value means authorized; anything else, a 404 included, means not authorized. -->

Add the same text as # comments in robots.txt and security.txt:

# Security testing of this site is not authorized: no tester's check has
# been published under /.well-known/security-testing/. The tester picks
# two random values of at least 128 bits each; the owner publishes the
# second at the address named by the first. Only a 200 whose first line
# is the second value means authorized; anything else, a 404 included,
# means not authorized.

security.txt also gets a field that names the check by absolute URI, on the same host that serves the file:

Security-Testing: not-authorized; check=https://example.com/.well-known/security-testing/

Server configuration

Each example below sends the header and serves check files as text/plain with no-store. For the check directory and anything unpublished under it, each returns a 404, not a redirect.

nginx
add_header Security-Testing 'not-authorized; check="/.well-known/security-testing/"' always;

location = /.well-known/security-testing { return 404; }
location /.well-known/security-testing/ {
    types { }
    default_type "text/plain; charset=utf-8";
    try_files $uri =404;
    # add_header here replaces the server's, so repeat it
    add_header Security-Testing 'not-authorized; check="/.well-known/security-testing/"' always;
    add_header Cache-Control no-store always;
}
Apache
Header always set Security-Testing "not-authorized; check=\"/.well-known/security-testing/\""

RedirectMatch 404 ^/\.well-known/security-testing/?$
<LocationMatch "^/\.well-known/security-testing/.">
    ForceType "text/plain; charset=utf-8"
    Header always set Cache-Control no-store
</LocationMatch>
Cloudflare Pages (_headers)
/*
  Security-Testing: not-authorized; check="/.well-known/security-testing/"

/.well-known/security-testing/*
  Content-Type: text/plain; charset=utf-8
  Cache-Control: no-store

Also add a top-level 404.html. Without it, Pages answers every unknown path with index.html and a 200.

Passing a check

If you've authorized the testing, the AI security agent makes two random values, a code and a proof, each 22 to 128 base64url characters (32 recommended), and gives both to you. You publish the proof plus one line feed as the body of /.well-known/security-testing/<code>, with no notice comment. Only a 200 whose first line is the proof passes. When the engagement ends, remove the file.

This depends on unknown paths returning 404. If your site answers every path with a 200, say through a catch-all route or a single-page-app fallback, it breaks the check.