Public: anyone can read this; the crew can change it.

/.well-known/security.txt's Expires is always a date between 30 and 365 days ahead, never a constant that lapses #13078

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

/.well-known/security.txt now works out its Expires date from the clock each time it is read. It adds 180 days to today and rounds down to the first of that month, so the date is always 150 to 180 days ahead and stays the same for a whole month at a time.

Notes

shipped production is serving it deploy 59903fa

opened this

/.well-known/security.txt now works out its Expires date from the clock each time it is read. It adds 180 days to today and rounds down to the first of that month, so the date is always 150 to 180 days ahead and stays the same for a whole month at a time. The old code always said 1 January of next year, which in December is only days away; production says 2027-01-01T00:00:00Z right now.

  • src/web/standards.ts: a new function, securityExpires(now), works out the date (the horizon is SECURITY_TXT_HORIZON_DAYS). securityTxt calls it with the current time. I kept the route handler's signature as it was, so the router can't pass anything into the clock.
  • test/standards.test.ts: a new test pins the clock at three instants:

- 2026-11-15 gives 2027-05-01 - 2026-12-31 23:59:59 gives 2027-06-01 - 2027-06-01 gives 2027-11-01

It also checks every 6 hours across 2026–2027 and requires each date to be 30 to 365 days ahead. On the old code the test fails: the function doesn't exist, and 31 December would give 2027-01-01. The existing endpoint test used to expect a -01-01 date. I changed it to accept any month start 30 to 365 days ahead, because that expectation was the constant this change removes.

  • Caching: the response is still no-cache. Even a cache kept for days would sit far inside the 150-day minimum.

Gate and type check pass. I ran six test files: standards, webspec-site, report-discovery, sealed-release, corp and compress-types; all 75 tests pass. scripts/fast.ts named 2006 test files for this two-file change, an estimated 170 minutes, so I ran the files that touch security.txt rather than its list. The forge's check runs the full suite on this push.

To try it, open /.well-known/security.txt on the preview. Today it should say Expires: 2027-05-01T00:00:00Z.

🤖 Generated with Claude Code

Closes #13065

commented

/.well-known/security.txt now works out its Expires date from the clock each time it is read. It adds 180 days to today and rounds down to the first of that month, so the date is always 150 to 180 days ahead and stays the same for a whole month at a time. The old code always said 1 January of next year, which in December is only days away; production says 2027-01-01T00:00:00Z right now.

  • src/web/standards.ts: a new function, securityExpires(now), works out the date (the horizon is SECURITY_TXT_HORIZON_DAYS). securityTxt calls it with the current time. I kept the route handler's signature as it was, so the router can't pass anything into the clock.
  • test/standards.test.ts: a new test pins the clock at three instants:

- 2026-11-15 gives 2027-05-01 - 2026-12-31 23:59:59 gives 2027-06-01 - 2027-06-01 gives 2027-11-01

It also checks every 6 hours across 2026–2027 and requires each date to be 30 to 365 days ahead. On the old code the test fails: the function doesn't exist, and 31 December would give 2027-01-01. The existing endpoint test used to expect a -01-01 date. I changed it to accept any month start 30 to 365 days ahead, because that expectation was the constant this change removes.

  • Caching: the response is still no-cache. Even a cache kept for days would sit far inside the 150-day minimum.

Gate and type check pass. I ran six test files: standards, webspec-site, report-discovery, sealed-release, corp and compress-types; all 75 tests pass. scripts/fast.ts named 2006 test files for this two-file change, an estimated 170 minutes, so I ran the files that touch security.txt rather than its list. The forge's check runs the full suite on this push.

To try it, open /.well-known/security.txt on the preview. Today it should say Expires: 2027-05-01T00:00:00Z.

🤖 Generated with Claude Code

commented

/.well-known/security.txt now computes its Expires from the clock: the first of the month that holds today + 180 days. That keeps it 150 to 180 days ahead, and it reads the same for a whole month. Before, it always said 1 January of next year, so in December it was only days ahead; production says Expires: 2027-01-01T00:00:00Z today.

  • Code: in src/web/standards.ts, the new securityExpires(now) computes the date; SECURITY_TXT_HORIZON_DAYS holds the 180. The securityTxt handler keeps its old signature and passes in the current time.
  • Tests: in test/standards.test.ts, a pinned-clock test checks three instants:

- 2026-11-15 gives 2027-05-01 - 2026-12-31 23:59:59 gives 2027-06-01 - 2027-06-01 gives 2027-11-01

It also checks every 6 hours across 2026–2027 that the date is 30 to 365 days ahead. On the old code the test fails: the function doesn't exist, and 31 December gives 2027-01-01.

  • Test I changed: the endpoint test expected a -01-01 date, which is the constant this change removes. It now accepts any month start 30 to 365 days ahead.
  • Caching: the response stays no-cache. Even a cache that lasted days would expire long before the 150-day minimum.
  • Commit messages: a "No look:" line explains that only plain text changes and no rendered page differs. The before/after looks rule failed the first check without it. Locally the gate passed both before and after adding the line, so it does not test that rule; only the forge's check on this push shows whether it is fixed.

Gate and tsc --noEmit pass. I ran the six test files that touch security.txt: standards, webspec-site, report-discovery, sealed-release, corp and compress-types, 75 tests, all passing. scripts/fast.ts named 2006 files for this change, an estimated 170 minutes, so I did not run its list; the forge's check runs the full suite.

To try it, open /.well-known/security.txt on the preview. On 2026-11-15 it says Expires: 2027-05-01T00:00:00Z.

🤖 Generated with Claude Code

Approved

The preview serves Expires: 2027-05-01T00:00:00Z. I checked the three pinned instants by hand and they match the test (2026-11-15 -> 2027-05-01, 2026-12-31 -> 2027-06-01, 2027-06-01 -> 2027-11-01). The change is plain text with no markup, so the design principles are not engaged. The response is a text file and has no terminal screen to mirror. Next, I would: (1) note the 180-day horizon and month rounding in docs/features if a security.txt page exists, so operators know the date moves; (2) have the endpoint test pin the clock instead of using Date.now(), so it cannot flake at a month boundary.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs