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

Every kind of answer carries the security floor: pages, JSON, errors, redirects, static assets and the MCP, proven in one test #15777

Merged opened this

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

Merged

test/security-floor-kinds.test.ts now covers every kind of answer #15763 names. The table already had pages, JSON, 404, 401, 403, 429, 500, the 303 sign-in redirects and static assets. This adds eight rows: 302 redirects: the stale /assets/forge.css link and /.well-known/change-password.

Notes

shipped production is serving it deploy 0adf720

opened this

test/security-floor-kinds.test.ts now covers every kind of answer #15763 names. The table already had pages, JSON, 404, 401, 403, 429, 500, the 303 sign-in redirects and static assets. This adds eight rows:

  • 302 redirects: the stale /assets/forge.css link and /.well-known/change-password.
  • 405: a browser GET of /mcp, and PUT on /api/v1/user.
  • 400: a sign-in whose body is not JSON.
  • MCP: a tools/list reply, and the reply to a message that is not JSON.
  • SSE: /api/v1/forge/view asked with Accept: text/event-stream.

Each row runs twice, against a forge on plain http and one declared https. Each must carry Content-Security-Policy, X-Content-Type-Options and Referrer-Policy, and every cookie must keep its flags. A new kind is still one row.

No header was missing, so src/http/respond.ts is unchanged. Every new row passed the floor check on its first run. The one mismatch was the test's own guess: a malformed MCP message answers 200 with a JSON-RPC parse error, not 400, so that row now expects 200.

Rows can't pass as the wrong kind. The three MCP and SSE rows also check their Content-Type. A row that fell back to, say, a JSON error page would otherwise pass the floor check while testing the wrong thing. A small unit test proves that check names the mismatch.

What I left out: MCP tools and their size ceilings are untouched; test/mcp-size.test.ts passes. scripts/gate.ts didn't need the file added, since it already existed. Nothing in the repository tried to steer the task.

To try it: bun test test/security-floor-kinds.test.ts (6 pass). bun x tsc --noEmit is clean and bun scripts/gate.ts --fix changed nothing beyond this file.

🤖 Generated with Claude Code

Closes #15763

commented

test/security-floor-kinds.test.ts now covers every kind of answer #15763 names. The table already had pages, JSON, 404, 401, 403, 429, 500, the 303 sign-in redirects and static assets. This adds eight rows:

  • 302 redirects: the stale /assets/forge.css link and /.well-known/change-password.
  • 405: a browser GET of /mcp, and PUT on /api/v1/user.
  • 400: a sign-in whose body is not JSON.
  • MCP: a tools/list reply, and the reply to a message that is not JSON.
  • SSE: /api/v1/forge/view asked with Accept: text/event-stream.

Each row runs twice, against a forge on plain http and one declared https. Each must carry Content-Security-Policy, X-Content-Type-Options and Referrer-Policy, and every cookie must keep its flags. A new kind is still one row.

No header was missing, so src/http/respond.ts is unchanged. Every new row passed the floor check on its first run. The one mismatch was the test's own guess: a malformed MCP message answers 200 with a JSON-RPC parse error, not 400, so that row now expects 200.

Rows can't pass as the wrong kind. The three MCP and SSE rows also check their Content-Type. A row that fell back to, say, a JSON error page would otherwise pass the floor check while testing the wrong thing. A small unit test proves that check names the mismatch.

What I left out: MCP tools and their size ceilings are untouched; test/mcp-size.test.ts passes. scripts/gate.ts didn't need the file added, since it already existed. Nothing in the repository tried to steer the task.

To try it: bun test test/security-floor-kinds.test.ts (6 pass). bun x tsc --noEmit is clean and bun scripts/gate.ts --fix changed nothing beyond this file.

🤖 Generated with Claude Code

Approved

Test-only change; passes locally and covers each kind in one table (a new kind is one row). Next: (1) assert the immutable Cache-Control on the static asset rows so that kind is proven immutable, not just a 200; (2) add the cause line to the pull saying no header was missing.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs