Public: anyone can read this; the crew can change it.
Every kind of answer carries the security floor: one test fetches a page, JSON, media, a 404, a redirect and a stream #16554
Check · Review · Land · Live done — Landed and live in production.
Adds media rows to the existing security-floor test. Most of #16301 was already on main: test/security-floor-kinds.test.ts (from #13674, #15777 and #15984) already fetches a page, JSON, a 404, redirects, an SSE stream, git smart-http, the MCP endpoint and static assets.
shipped production is serving it deploy 3256dd5
Adds media rows to the existing security-floor test. Most of #16301 was already on main: test/security-floor-kinds.test.ts (from #13674, #15777 and #15984) already fetches a page, JSON, a 404, redirects, an SSE stream, git smart-http, the MCP endpoint and static assets. It checks Content-Security-Policy, X-Content-Type-Options and Referrer-Policy on each answer, and a failure names the kind that lacks a header. What it never asked for was media, nor the byte-range answers the issue's risk note points at.
What changed: the test's forge now commits a PNG, a 1.1 MB MP4 and a text file. Five rows are added, each asked over plain http and over https:
- a picture:
/media/…/logo.png, 200,image/png - a byte range of a small file: 206, served from memory
- a byte range of the large file: 206,
video/mp4. The file is over the media route's 1 MB limit for reading whole, so this exercises the path that streams bytes from git withContent-Range. - a range past the end: 416, the reply that carries
Content-Range: bytes */size - raw text:
/raw/…/notes.txt,text/plain
The coverage test now also requires 206 and 416 statuses and at least three media rows.
Nothing needed fixing. Every new row already gets the headers from securityFloor in src/http/respond.ts, including the streamed and 416 answers, so no source file changed. I put the rows in test/security-floor-kinds.test.ts instead of creating the test/security-floor.test.ts the issue names, so all the kinds stay in one table. I reused the PNG and MP4 test files from test/media.test.ts rather than writing new ones.
Checks: bun test test/security-floor-kinds.test.ts passes (6 tests). bun scripts/gate.ts --fix changed nothing and bun x tsc --noEmit is clean.
To try: bun test test/security-floor-kinds.test.ts. To see a failure name its kind, remove the content-range line in the 416 branch of src/web/pages/media.ts and add headers.delete("referrer-policy") there. The test then fails with "media, 416 range past the end (416) lacks referrer-policy".
🤖 Generated with Claude Code
Test-only change that adds five media rows (picture, buffered range, streamed range off git, 416, raw text) to the existing security-floor table, over http and https. Tests pass here (6 pass). The three headers were already on every answer, so no source change is needed and none is hidden. Next two things I would do: (1) the first-line comment in the file now wraps awkwardly; reflow it. (2) Assert the 416 row also carries Content-Range, so the row proves it is the real range-refusal path.
Adds media rows to the existing security-floor test. Most of #16301 was already on main:
test/security-floor-kinds.test.ts(from #13674, #15777 and #15984) already fetches a page, JSON, a 404, redirects, an SSE stream, git smart-http, the MCP endpoint and static assets. It checks Content-Security-Policy, X-Content-Type-Options and Referrer-Policy on each answer, and a failure names the kind that lacks a header. What it never asked for was media, nor the byte-range answers the issue's risk note points at.What changed: the test's forge now commits a PNG, a 1.1 MB MP4 and a text file. Five rows are added, each asked over plain http and over https:
/media/…/logo.png, 200,image/pngvideo/mp4. The file is over the media route's 1 MB limit for reading whole, so this exercises the path that streams bytes from git withContent-Range.Content-Range: bytes */size/raw/…/notes.txt,text/plainThe coverage test now also requires 206 and 416 statuses and at least three media rows.
Nothing needed fixing. Every new row already gets the headers from
securityFloorinsrc/http/respond.ts, including the streamed and 416 answers, so no source file changed. I put the rows intest/security-floor-kinds.test.tsinstead of creating thetest/security-floor.test.tsthe issue names, so all the kinds stay in one table. I reused the PNG and MP4 test files fromtest/media.test.tsrather than writing new ones.Checks:
bun test test/security-floor-kinds.test.tspasses (6 tests).bun scripts/gate.ts --fixchanged nothing andbun x tsc --noEmitis clean.To try:
bun test test/security-floor-kinds.test.ts. To see a failure name its kind, remove thecontent-rangeline in the 416 branch ofsrc/web/pages/media.tsand addheaders.delete("referrer-policy")there. The test then fails with "media, 416 range past the end (416) lacks referrer-policy".🤖 Generated with Claude Code
Closes #16301