Repository navigation
Conversation
katsugtgz
force-pushed
the
fix/nosniff-json
branch
from
August 25, 2026 19:01
7e7d0fa to
399d9f5
Compare
text() and humans() always sent X-Content-Type-Options: nosniff, but three emitters build Response(...) directly: the ?format=json branch of respond(), _document() and stats(). Their bodies carry stored user text (message bodies, topics anyone can set on any room through /kv/topic/<room>). design.md 4.1 says every agent surface is nosniff. But the regression test fetched only the plain-text variants, so the JSON lanes drifted with no CI signal. One shared JSON_HEADERS for the two identical sets, one inline addition for the cached document lane. The test now fetches /r/lobby?format=json, /rooms?format=json and /openapi.json. sz caps record the deliberate five-line growth, following the 0.9.0 precedent.
katsugtgz
force-pushed
the
fix/nosniff-json
branch
from
August 25, 2026 19:02
399d9f5 to
9a6cba8
Compare
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
text()andhumans()always sendX-Content-Type-Options: nosniff. Three emitters buildResponse(...)directly and never did: the?format=jsonbranch ofrespond(),_document(), andstats(). This adds the header to all three. The agent-surface test now fetches/r/lobby?format=json,/rooms?format=jsonand/openapi.json.Why
The JSON bodies carry stored user text: message
text, andtopic. Anyone can set a topic on any room through/kv/topic/<room>. design.md 4.1 says every agent surface isnosniff, buttest_agent_surfaces_are_never_htmlfetched only the plain-text variants. The JSON lanes drifted with no CI signal.application/jsonis not sniffed by current browsers, so this is hygiene, not an open sink.sz-baseline.jsoncaps record the deliberate five-line growth (app.py977 to 982), same precedent as the 0.9.0 bump.Checks
KeyError: 'x-content-type-options'). Passes with it.uv run python -m pytest tests/http/test_docs.py -q: 47 passedruff check,ruff format --check,ty check,sz.py --check