Skip to content

fix(integrity): read long control labels in overlapping windows #1424 - #1455

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/integrity-label-windows-1424
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/integrity-label-windows-1424

Conversation

@nc9

@nc9 nc9 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1424. Rework of this PR after the review of #1454: it is now William's window commit (d10665e0, authorship kept; same change as #1454's a9e04bba) plus one lane commit. Replaces my earlier overlapping-window design.

Kept from William's commit

Windows of 300 characters, stride 150, over the first 16,000 normalised characters of each attribute (aria-label, title, value, logo alt); unread only above 16,000 characters (raw or normalised).

Lane commit

  • Cue prefilter derived from the lexicon (brand-specs.ts is the brand data moved out of signals.ts, re-exported from it): a window past an attribute's first is read only if the start of a sign-in or brand phrase is in it. The alternatives are built from the auth cues and every lexicon phrase (first word, a short first word joined to the second as sign ?in), so a new phrase widens the prefilter by itself. A drift test checks every lexicon phrase, auth cue and provider-button form passes it, and that designers, blog, logistics do not.
  • At most 40 windows per attribute (first ones and last).
  • Two page budgets, fail safe. 10,000 windows are spent in order (controls with a cue word as written first, then DOCUMENT order, not shortlist order), so the first controls of the page are always read in full however much padding follows; 10,000 are shared fairly over the controls still cut (at least 1 each while any is left). Anything a cap or the budgets cut counts the control in controlsUnread, and the info note is emitted even with no hit. The budgets are integrityLimits, a mutable object, so a test can exhaust them.
  • Seams: a window edge inside a word gets a letter stuck on it, both at the start and the end, so Redesign in with Google Workspace cannot read as sign in with Google (William's version hit 3 of 460 padding alignments, Login with GoogleMail 2 of 460).
  • Docs: the stale "counted as unread when ..." sentence is replaced; the separate window budget, its two halves and the counted-note limit are stated; integrity/brand-impersonation: an attribute label padded with real characters before the phrase is cut at 300 #1424 stays in the known limits. CHANGELOG reworded.

Tests

  • integrity-evasions-784.test.ts (35): every attribute (aria-label, title, value, logo alt, input-image alt) with padding on both sides at every offset 0..460; deep and split phrases; a 400-word label; the look-alikes (Redesign in with Google Workspace, Login with GoogleMail, Plugin with Google) at every padding 0..460; William's 16,000/16,001 boundary and NFKC test; the drift guard.
  • integrity-budget-784.test.ts (27, RuleRunner at the default budget): 300 controls with 16 KB U+FDFA labels finish and find the real control; 21,000 cue-bearing decoys (8.6 MB) after the real padded control: found; before it: found or counted unread; 5,000 benign long-label controls before the real one; exhausted budgets (lowered through integrityLimits): first-window phrase found, deep phrase found or noted, hostile-only page emits controlsUnread.
  • Mutations killed: no seam letter fails the look-alike test; no sequential budget fails the 21,000-decoy test.

Cost (RuleRunner, brand rule; this branch vs #1454's cut)

shape size branch #1454
300 / 450 U+FDFA 16 KB labels 4.8 / 7.2 MB 1,065 / 1,616 ms 1,227 / 1,918 ms
600 U+FDFA 16 KB labels 9.6 MB rule abandoned at 2 s same
21,000 cue decoys 8.6 MB 478 ms 428 ms
100k tiny controls 4.5 MB 359 ms 364 ms
5,000 benign long labels 3.0 MB 59 ms 88 ms

The U+FDFA hole is pre-existing and not lowered: at 600 such controls (9.6 MB) the rule is abandoned at the 2 s budget on main and on #1454 too, because the NFKC expansion of 16,000 characters per label costs about 2 s over that many labels. Not part of this change.

Integrity suites (incident corpus 69, evasions, adversarial 36, budget, text-boundary 14, cloaking 8), streaming-rules-golden, streaming-collector-rules-golden, tsgo, docs make validate.

Skill change: none.

nik

WilliamK112 and others added 2 commits November 1, 2026 07:30
…, two page budgets ordered by cue tier then document order, window edges marked, counted notes, wider tests #1424

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9

nc9 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.152 as c09396f9 794e1dc3 (William's commit plus a maintainer follow-up) via #1461. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.152. Closing this original.

nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants