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

Every kind of response the forge writes carries the security floor, proven by one test over the kinds #15984

Merged opened this

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

Merged

The security-floor test now also checks git smart-http answers. test/security-floor-kinds.test.ts already tested a page, a JSON answer, a 404, a 500, an SSE stream, a hashed asset and redirects (#15777). Git smart-http was the only kind the issue names that it didn't ask.

Notes

shipped production is serving it deploy 0adf720

opened this

The security-floor test now also checks git smart-http answers. test/security-floor-kinds.test.ts already tested a page, a JSON answer, a 404, a 500, an SSE stream, a hashed asset and redirects (#15777). Git smart-http was the only kind the issue names that it didn't ask.

What changed

  • The test's setup creates a public repo pat/floor, and the table gains four rows:
    • the refs advertisement (info/refs?service=git-upload-pack, 200)
    • the streamed git-upload-pack POST (a protocol-v2 ls-refs, 200)
    • the "smart http only" refusal (info/refs with no service, 400)
    • a push advertisement asked without credentials (401)
  • The two 200 rows also assert their git Content-Type, so a row that quietly answered as another kind fails instead of passing.
  • Each row is asked on a plain-http forge and on an https one. All four carry Content-Security-Policy, X-Content-Type-Options and Referrer-Policy.

What I chose not to do

  • src/http/respond.ts is unchanged. The new rows found no gap, so there was nothing to fix in securityFloor, and that includes the streamed upload-pack body.
  • The existing self-test already shows that a missing floor header fails with the kind's name, so I didn't add another. The kinds-coverage test now also requires the git row.

How to try it bun test test/security-floor-kinds.test.ts (6 pass). bun scripts/gate.ts --fix rewrapped one comment, which is committed, and bun x tsc --noEmit is clean.

🤖 Generated with Claude Code

Closes #15967

commented

The security-floor test now also checks git smart-http answers. test/security-floor-kinds.test.ts already tested a page, a JSON answer, a 404, a 500, an SSE stream, a hashed asset and redirects (#15777). Git smart-http was the only kind the issue names that it didn't ask.

What changed

  • The test's setup creates a public repo pat/floor, and the table gains four rows:
    • the refs advertisement (info/refs?service=git-upload-pack, 200)
    • the streamed git-upload-pack POST (a protocol-v2 ls-refs, 200)
    • the "smart http only" refusal (info/refs with no service, 400)
    • a push advertisement asked without credentials (401)
  • The two 200 rows also assert their git Content-Type, so a row that quietly answered as another kind fails instead of passing.
  • Each row is asked on a plain-http forge and on an https one. All four carry Content-Security-Policy, X-Content-Type-Options and Referrer-Policy.

What I chose not to do

  • src/http/respond.ts is unchanged. The new rows found no gap, so there was nothing to fix in securityFloor, and that includes the streamed upload-pack body.
  • The existing self-test already shows that a missing floor header fails with the kind's name, so I didn't add another. The kinds-coverage test now also requires the git row.

How to try it bun test test/security-floor-kinds.test.ts (6 pass). bun scripts/gate.ts --fix rewrapped one comment, which is committed, and bun x tsc --noEmit is clean.

🤖 Generated with Claude Code

Approved

Test-only change; the new git smart-http rows (refs advertisement, streamed upload-pack, 400, 401) pass over http and https (6 pass locally), and no gap was found so securityFloor is untouched. Next: (1) the header comment still says "git smart-http" wraps mid-sentence unevenly; fine, but add the git rows to the self-test so a git row lacking a header is proven to fail by name. (2) Add a docs line or test for git receive-pack POST (push) answer, the one git kind still unasked.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs