---
id: HSCP-T-004
titre: "security.txt file compliant with RFC 9116 and not expired"
titre_court: "Check the security.txt file"
type: note
objet: test
langue: en
statut: brouillon
version: 0.1
verifie_le: 2026-11-22
traduit_de: LISEZ-MOI.md
traduit_de_version: 0.1
traduit_de_empreinte: e17b01f7a22a2037
traduction: modèle de langue, glossaire catalogue/glossaire-en.yaml
source: traduction de LISEZ-MOI.md, version 0.1
sensibilite: interne
licence: Apache-2.0
gestes: [HSCP-G-145]
recette: HSCP-R-013
piece: configuration
---

# security.txt file compliant with RFC 9116 and not expired

## What the test checks

The evidence item is a copy of the `/.well-known/security.txt` file served by the product. The test accepts it if:

- every line is empty, a comment or a `Name: value` field;
- it carries at least one `Contact`, as a `mailto:`, `https://` or `tel:` address;
- it carries a single `Expires`, a date and time with a time zone, not past;
- every web address (`Contact`, `Canonical`, `Encryption`, `Acknowledgments`, `Policy`, `Hiring`, `CSAF`) starts with `https://`;
- `Preferred-Languages` appears at most once and lists language tags;
- if `--url` is given and the file declares `Canonical` fields, the address is one of them.

It reports without refusing an expiry more than a year away (the RFC advises against it), a missing `Canonical`, and an OpenPGP signature (which it does not verify).

## Running the test

The test does not access the network. First fetch the served file, then check the copy:

```sh
curl -fsS https://example.org/.well-known/security.txt -o security.txt
python3 verifier.py security.txt --url https://example.org/.well-known/security.txt
```

`--date` sets the instant of the check, `--json` gives the answer in JSON. Exit code: 0 evidence accepted, 1 evidence refused, 2 incorrect call. Python 3.10 or later, no dependency.

Run every day, the test refuses the file as soon as it expires: that is the monitoring needed, earlier if a margin is added to `--date`.

## Examples

- `exemples/valide/`: two contacts, an expiry six months away, the policy and the canonical address. Accepted.
- `exemples/refuse/`: a contact without `mailto:`, a past expiry, a policy over `http://`, a canonical address that is not the one the copy comes from, a line of free text. Refused.

## What the test does not say

- It does not say that the contact answers, nor that the announced policy is applied.
- It does not say that the file is served at the right place: the fetch command shows that.
- It does not verify the OpenPGP signature.
