feat(chart): serve security.txt (RFC 9116)

Merged
GE
2m ago
+126-1

Why this change is needed

A running installation has no way to tell a security researcher where to report a vulnerability. RFC 9116 defines that as a file at /.well-known/security.txt on every host that is reachable over HTTPS, with at least a Contact and an Expires field.

What changed

  • templates/security-txt.yaml: a ConfigMap, an HTTPRouteFilter direct response and an HTTPRoute with an exact path match, the same mechanism as the discovery document. The exact match wins over the prefix route that serves the rest of a hostname, so one route covers every listed hostname.
  • values.yaml: securityTxt, off by default: httproute.parentRefs, httproute.hostnames, contact, expires, and optional preferredLanguages and policy. Each hostname gets a Canonical field.

The chart refuses to render when a contact is not a mailto:, https:// or tel: URI, and when expires is missing, unparseable or in the past. The last check means an upgrade fails once the date has passed, until someone confirms the contact and sets a new date. That is deliberate: an expired file is treated by researchers as stale.

Like the discovery document, this needs Envoy Gateway.

Verification

helm template with the option on renders the three resources and this body:

Contact: mailto:sec@example.com
Contact: https://example.com/report
Expires: 2027-06-01T00:00:00Z
Preferred-Languages: nl, en
Canonical: https://a.example.com/.well-known/security.txt
Canonical: https://b.example.com/.well-known/security.txt

Each validation failure was rendered once and gives its own message. With default values nothing is rendered, and helm lint passes. Not deployed to a cluster.