Repository navigation
Conversation
This was referenced Oct 31, 2026
…work, every cut reported #784 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/integrity-evasions-784
branch
from
October 31, 2026 03:50
9b454bd to
466c8df
Compare
This was referenced Oct 31, 2026
Merged
Contributor
Author
|
Landed in v0.0.148 as nik |
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.
Closes #784
Security-sensitive: needs an independent review before merge.
What changed
<button>,input type=submit|button|imageandrole=button, label read from text,aria-label,title,valueand a logo'salt; a button's destination is itsformactionor its form's action. "Continue with Google", "Log in with Google" and the Microsoft pair are in the lexicon.<template>content is read.login.windows.net,login.microsoftonline.us,b2clogin.comare not off-brand (suffix match on a label boundary, soauth0.com.evil.invalidstill flags).!important,inset, andiframe/.class/#idrules in<style>blocks (at-rules skipped, source order,!importantwins).Adversarial pass (review round 1: the automated security review's five classes)
overlay-style.ts(was real). The comment-strip regex/\/\*[\s\S]*?\*\//grescanned to the end for every unterminated/*, and the rule regex rescanned up to 300 characters from every start. Replaced by one hand-written tokenizer (indexOfonly moves forward, the cursor then moves past what it found). Tested on 4 MB of: unterminated comment openers, no braces,a{openers, nested unclosed@media, closing braces,a:b;runs, a 2 MB selector,!importantsoup; each is milliseconds. A 1 MB inline style attribute of spaces and bangs, 3,000 iframes against a 4,000-rule sheet, and 10k nested anchors are also linear.MAX_CONTROLSkept the first 3,000 controls, and the CSS reader kept the first 20 blocks / 2,000 rules / 64 KB. Now: every control is listed; text reading is spent in order of relevance (a sign-in attribute, then buttons and links to another host or a sign-in path, then the rest) with a short read for all and full reads for the top ranks, not in document order; CSS is read up to 4 MB, and only rules that can match an iframe on the page are kept, indexed by token, so padding rules, controls or iframes before the real one cannot push it out. Tested: 6,000 padding controls then the real one; 400 long off-site labels burning the full-read budget then a plain one; a wall of 8,000 text links then an attribute-only control; 2.5 MB of junk rules and 4,000 benign iframes before the overlay.details.controlsUnread/details.cssTruncatedon the check (tested). A page that exceeds a bound without a hit emits no check, because the rules emit nothing when there is no hit (streaming and resident parity); the note is only visible on a hit. Known limit.src(userinfo, query tokens, fragment, unbounded) and rawid. Now an origin and path only (120 characters), and[\w-]only for the id (tested). The brand reason shows hosts only.<a>(the parser nests, a browser auto-closes; reading per control is bounded either way),<noscript>content (scripting on vs off),srcdociframes (not scanned), CSS cascade beyond simple selectors,@layerand@container(skipped). Listed as limits, none turned into a verdict.Tests
integrity-adversarial-784.test.ts(19: perf bounds and the cases above),integrity-evasions-784.test.ts(10), the existing integrity suites, streaming goldens.streaming-page-rules-goldenfailed once under load (a timeout) and passed 3 times alone. Docs for both rule pages and CHANGELOG updated. Skill change: none.nik
Review round 2 (independent high-effort review of a7cca92)
iframe{}rules and 20,000 iframes.infobrand-impersonation(orfake-auth-overlayfor CSS) check withdetails.scanTruncated. RuleRunner tests: 1.5 MB of node-heavy decoys, 3.5 MB ofrole=buttondecoys, a label padded with 20,000 empty elements (note emitted), CSS past 4 MB.<script>,<style>,<noscript>are not text (as on main); hiding by font-size 0, opacity 0,aria-hidden,hidden, inline or class-based; provider phrases also match with all spaces removed, soSign<br>in with Goo<i>gle</i>reads.evil.supabase.co/functions/...,evil.auth0.com/loginand Calendly to a broker are flagged again (tests).form=,aria-labelledbyand depth up to 64 (a depth bound) are honoured; tests for the 25th template, a nested template, 500 logos before the control, a button 30 levels inside its form, a logo 30 levels deep.infosingle signal (never a failure alone); documented as the trade-off with F5. F7b:inset: 0counts as a viewport cover only when the iframe has no width and height of its own (test).securitylabel, no priority.oxlint -c apps/cli/oxlint.config.mjson the changed files: only the pre-existingno-object-as-default-parameterin signals.ts remains (it is on main too).Review round 3 (the automated flags: total work bound, allowlist, and a whole-diff pass)
role=buttonnested inrole=buttontook 23 s / 100 s / 172 s (every nested control read to its own cap). Now the page as a whole has 400,000 node visits to spend, shared fairly (allowance = what is left / controls still to read, at least 4, at most 256), so neither a flood of decoys nor nesting can starve the real control or multiply the cost; controls with no destination are not read at all; the form and logo lookups are memoised along the path (linear in nodes, whatever the depth);aria-labelledbytargets come from one id map built once (it was a lookup per control per root). After: the same shapes take 0.2 / 0.5 / 2.0 s.integrity-adversarial-784.test.ts): leafrole=button, buttons in forms, controls with 256 empty children, nested controls, controls under 200 wrappers,form=references, a template per control,aria-labelledbywith a template each, nested forms withform=and a template each. At 1 MB and 2 MB: the real control is found, and 2 MB costs under 6x of 1 MB; at 5 MB the nested, forms and template shapes are found within 20 s (measured 2 to 3.3 s). The runner's own 2 s rule budget still abandons a rule on a page this size, reported as a skipped-errorcheck, as for any rule./authorize,/oauth2/.../v1/authorize,/oauth2/authorize,/auth/v1/authorize,/__/auth/handler) is spared;evil.supabase.co/functions/...,evil.auth0.com/login,evil.okta.com/login/...,evil.firebaseapp.com/...,evil.amazoncognito.com/loginand Calendly to a broker are flagged (tests). No host is allowed wholesale.HIDDEN_STYLE,SIMPLE_SELECTOR,/!\s*important$/and the provider patterns were run on megabyte inputs; the CSS scan has no backtracking regex and is exercised on eight hostile shapes.normalize()only ever sees mark-free text (the 120 KB marks test).infocheck.<a>,<noscript>with scripting on,srcdoc/about:blankiframes, CSS beyond simple selectors,@layer/@container, escapes (integrity/fake-auth-overlay: model more of the CSS that styles an overlay iframe #1409); look-alikes beyond the table (integrity detectors: complete the confusables table (UTS#39 skeleton) and digit swaps #1410).Round 2: nested templates are read in place (no clone),
aria-labelledbytargets are read once and bounded, overlay rules are capped per frame with a page-wide work budget, plain own-site links are not read, the squashed phrase match needs whole-phrase boundaries, and default-budget RuleRunner tests cover each hostile shape. Tenant-owned broker and Google user-content hosts are tracked in #1418.nik