Repository navigation
Item 7.16: opaque-response blocking for scripts, sheets and no-cors fetch(), proven (theorem_orb) - #307
Merged
Conversation
clazel-fetch gains orb::spec, a transcription of the opaque-response-safelist check of whatwg/fetch pull request #1442 (head c58393bf), with Fetch's "extract a MIME type" and "determine nosniff" at the pinned commit, and orb::contract for the executable check. clazel-kernel spec: a style sheet or script fetch whose response is not basic fails unless ORB allows it (orb_end, through api_finish), and a no-cors Fetch's opaque response needs ORB too (api_end). theorem_orb's statement is in statements.rs. The CORS check and HTTP fetch section numbers are corrected to the pinned commit (§4.10, §4.4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
orb::check is the executable opaque-response-safelist check, with extract a MIME type and determine nosniff, proven equal to orb::spec. orb::lemmas states what the check's design rests on (safelisted types allowed, never-sniffed types blocked, HTML/JSON/XML never allowed unless they sniff as an image and blocked outright with nosniff, 206 and media bytes blocked, untyped image bytes and untyped ok responses allowed); orb::examples evaluates the check on concrete responses. Ten mutations of the spec are certified kills. tests/orb.rs runs the exec check on hand-written responses, every never-sniffed essence among them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tem 7.16) The exec kernel runs clazel_fetch's ORB check where the spec does (orb_blocks_exec in the SubNet step, orb_allows_exec in api_end_exec), and theorem_orb is proven over SubNet: a no-cors sub-fetch's renderer gets its failure frame unless the response is basic or ORB allows it. Meaning-preserving changes to the spec since its contract commit, for the solver: orb_allows is a closed function in its own module (src/orb.rs), with lemma_orb_allows for the proofs that read it, because carrying MIME parsing and sniffing in the noninterference proofs' context ran them out of time; orb_end is opaque; api_finish calls orb_end only when the fetch ended. lemma_d_subnet hides api_end and uses two by-ending-action lemmas; lemma_run_acts hides the sub-fetch functions. Tests: ORB through the kernel in tests/fetch_api.rs (scripts, sheets and no-cors fetch(); the support decoder now groups Script* frames). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three new kills: ORB skipped for style sheets and scripts (ml_orb_blocks_sheet), a no-cors Fetch's opaque response without ORB (ml_no_cors_orb_blocks), and a redirect-tainted response counted as basic (ml_orb_checks_tainted). The certificates that evaluate ORB sit in src/orb.rs, where orb_allows's body is visible. no-cors-gives-body is re-anchored on the new api_end line, and its lemma now names the response it is about (ORB allows it), since the old lemma held for every response; its expect is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atiernan
temporarily deployed
to
full-verification
November 25, 2026 03:02 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Item 7.16's script-fetch rule (7.0(c) S1): opaque-response blocking on every "no-cors" response, proven (
theorem_orb), with ORB itself transcribed and proven inclazel-fetch.Inventory: what
main(035eb42) already had for 7.16FetchIPC message (fetch() and XHR),FetchResponse/FetchBody/FetchEnd/FetchFailedclazel-ipctag 20, 119-122 (#29x, commits 5a326d1, 9b5fd88)theorem_forbidden_headers;clazel-fetch'sreq_okrefuses any request still carrying oneapi_theorems.rs,clazel-fetchrequest specOriginset by the kernelPOST)clazel-fetchrequest specRefererset by the kernelRefereris ever sent (a page cannot set one; the kernel sends none, as policy "no-referrer" would)cors_checkandtheorem_cors_read(credentials mode "same-origin" only)spec.rs,api_theorems.rscredentialedon the transducer's current URL,theorem_subfetch_credentials), page headers dropped on a cross-origin redirect, redirect-taint makes the CORS originnull; redirect mode (follow/error/manual) is not in the messagespec.rsFetchScriptandFetchStylehanded cross-origin bodies over wholetheorem_script_fetch_shapesubfetch_theorems.rstheorem_url_update_same_originurl_rel.rstheorem_popup_needs_input,javascript:URLspopup_theorems.rstheorem_cookie_noninterference,theorem_address_bar_integrityrestated over the new messagesFetchScript,Fetch,UpdateUrl,OpenTab; the address bar names the document URL)ni_theorem.rs,display_theorems.rs,url_rel.rs,popup_rel.rscredentials: "include"goes without cookiesFetchmessage has no credentials field, every request is "same-origin" credentials, so cross-origin hops never carry cookies. "omit" and "include"'s stricter CORS check are not expressibleWhat this PR adds
clazel-fetch:orb(spec, contract, exec, lemmas, examples, tests, 10 certified mutations).59afe349). The WHATWG text is whatwg/fetch pull request #1442 (open, unmerged);orb/spec.rspins its head commitc58393bf0b9e2a86abee916c3cef3361f2741567and transcribes §2.11.1 "The opaque-response-safelist check" (steps 1 to 15) and §2.11.2's three MIME type sets, with Fetch §3.5 "extract a MIME type", §3.6 "determine nosniff", §2.2.2 "get, decode, and split" and §2.2.3 "ok status" at the pinned commit. Section numbers were read at those commits (no †).Allowed/Blocked/JavaScriptCheck(step 15, "determine if response is JavaScript and not JSON", is left to the caller); no-cors media request state is always "N/A" (no media elements); every 206 counts as an invalid partial response (no request carriesRange; stricter than the standard); the first 1024 bytes are never failure (the body is complete); "extract a MIME type" omits its charset bookkeeping (ORB reads only type, subtype and essence).nosniffan HTML/JSON/XML type is blocked even with image bytes; a 206 is blocked unless safelisted; media bytes are blocked; untyped image bytes are allowed; untyped ok responses are allowed (step 13); a typed, non-safelisted response that does not sniff as an image is neverAllowed.tests/orb.rs: every step that can decide, all 35 never-sniffed essences (typed independently of the hex literals), header-name case, multiple values, quoted commas.clazel-kernel: ORB on every "no-cors" sub-fetch.StyleFailed/ScriptFailed(orb_end, throughapi_finish).Fetchin mode "no-cors": the opaque response now needs ORB; otherwiseFetchFailed(api_end).src/spec.rsand the README): ORB's step 15 is not run and a response reaching it is blocked (a cross-origin script served astext/plainorapplication/octet-streamfails to load); the check is also applied to a final 3xx withoutLocation, which Fetch exempts.theorem_orb(new, inCargo.toml's list): for everySubNeton a "no-cors" sub-fetch (style, script, orFetchmode 2), every frame to a renderer is the sub-fetch's failure frame unless the transducer ended with a response that is basic or that ORB allows.orb_allowsis aclosedfunction in its own module (src/orb.rs, withlemma_orb_allowsstating its definition), because carrying MIME parsing and sniffing in every step proof's context madelemma_d_subnetrun for many minutes at 10+ GB;orb_endis#[verifier::opaque];api_finishcallsorb_endonly when the fetch ended.lemma_d_subnethidesapi_endand uses two new by-ending-action lemmas;lemma_run_actshides the sub-fetch functions. The full kernel now verifies in under 4 minutes locally (1083 verified, 0 errors).no-cors-gives-bodyre-anchored (itsfindnames the newapi_endline; its certificate's lemma now fixes the response it speaks of, since the old one held for every response and no longer does;expectunchanged). The certificates that evaluate ORB live insrc/orb.rs, where the closed body is visible.Not done (still open for 7.16)
OPTIONSrequest withAccess-Control-Request-*(headersreq_okforbids an author to send, so a separate field inclazel-fetch'sReq), a non-redirecting transducer run, a second phase inSubFetch, and the noninterference relation over it. Until then every request that would need one is refused (as before).Fetch("omit", and "include" with the include-mode CORS check and S1's no-cookies deviation). The message has no field for it; S1's cookie rule holds because every request is credentials "same-origin".Fetch.Referer: never sent.fetch/orb/) need script; hand-written tests only.61c1be7differs in its never-sniffed list and in step 15, so it is not a second transcription of the same text).Verification
Local
cargo xtask verify --changed(58 min; kernel Verus 1083 verified, 0 errors; kernel 105/105 and fetch 97/97 mutations certified kills), last line verbatim:This is not ALL CHECKS PASSED.
CI has not run on this branch; the proof jobs need a
full-verificationapproval. Nothing here is done untilFull verificationis green.🤖 Generated with Claude Code