Repository navigation
Conversation
…the whole viewport #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
…in/max sums, logical inset #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
…, CSS escapes/comments undone #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
… before splitting declarations #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
…losers per CSS Syntax 3 #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
… decides; brace-aware rule cut; url() by decoded ident; newline normalisation #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
… escape, CSS whitespace, at-rule/selector preludes via walk, superset property tests #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
…ses; docs: CDO/CDC limit #1496 Signed-off-by: Nik Cubrilovic <[email protected]>
Merged
Contributor
Author
|
Landed in v0.0.156 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 #1496.
integrity/fake-auth-overlaydecided that a frame fills the viewport withincludes("100%"),includes("100vw")andincludes("100vh")only. The dynamic, small and large viewport units andvmax/vminwere not recognised, so a full-screen fixed frame sized with them was not a cover.Change (
overlay-style.ts)FULL_WIDTHandFULL_HEIGHT:100followed by%,vw/vhand theird/s/lforms,vmaxorvmin, not preceded by a digit or a dot, so it works insidecalc(),max()andmin()and1100%or100.5%no longer count. Theinset: 0rule is unchanged (the optional change to stop it counting for an iframe is left out: it needs its own decision).Tests (
integrity-evasions-784.test.ts, 40 pass; 3 of them fail against the unchanged source)calc()andmax()forms) makes a fixed#google-authframe a cover.50dvw/100dvh,100dvw/50dvh,100px,1100%,100.5%, a mixed-up axis (100dvhas width) and300px/100dvhare not.<style>rule.Docs and CHANGELOG updated. Skill change: none.
nik
Follow-up: spellings (head c14d0a0)
Accepted:
100.0%,100.00vw,+100vw,1e2vw,1E2%,101vw/150%/200vh(over-full, up to 1000),calc(50vw + 50vw),calc(100% - 0px),max()/min()/clamp()(numbers of the axis summed),vi/vb(and d/s/l forms),cqw/cqh/cqi/cqb,stretch,fill-available,-webkit-fill-available,-moz-available;inset-block,inset-inlineand theinset-*-start/endlonghands. Not covers:10vw,100px,1100vw,0.100vw,50%,-100vw, wrong-axis units.Documented limits:
var(--w)is not resolved; a fixed length incalc()is not subtracted.Skill change: none.
Round 2 (auto security review)
10000vw,1e5vw,1e400vw,1100vw,calc(2000vw - 1900vw),max(-5vw, 100vw)fill; products/quotients of an axis length (calc(100vw * 20)) count as filling (documented, errs toward detection). Negatives are skipped only outside calc/arithmetic (-100vwalone is off-screen).1\30 0vw,100v\w,100\76 w,\31 00vw, escaped propertywid\74 h) and comments (incl.width:/*;*/100vwthat hid the;) are undone before parsing.1100vw/1100%are real over-full widths, now covers (previous negatives came from the old digits-before-100 regex).Round 3 (auto security review): declaration tokenizer
stripComments+split(";")replaced by one linear tokenizer (splitDeclarations):;splits only outside strings/brackets/parens,/*opens a comment only outside strings (unterminated runs to the end), unquotedurl(...)is one token, backslash escapes the next char, a string ends at its quote or an unescaped newline. Escapes are undone per declaration after the structure is split. Tests:content:"/*",'/*',url(data:image/png;base64,AAA),"a;b",{;},[;], escaped quotes,\/*,width:/*;*/100vw, plus a structured random generator (2,000 mixes with a known answer) and 1 MB hostile inputs under 2 s. Mutation: naivesplit(";")fails 2 tests.Round 4 (auto security review): block stack
The tokenizer keeps a stack of expected closers (
(->),[->],{->}): a closer pops only if it matches the top, any other closer is an ordinary token,;splits only with an empty stack outside strings, unclosed blocks end at EOF. Context handled: a declaration list (style attribute, or a rule body already cut out of its braces byscanCss); a top-level unmatched}is an ordinary token. Direction: match the browser (an unclosed block swallows the rest of the list, so nothing aftera:(]is read); the shapes that need it are not in real styles. An unquotedurl(needsurlto be a whole identifier. Tests: shapesa:(],a:[},a:{),a:(,calc((1),url(, stray closers, balanced blocks; 20,000 random delimiter mixes compared with a differently-structured recursive reference of the spec; mutation (pop on any closer) fails 2 tests.Round 5 (auto security review): union of readings, fail toward detection
<style>rule cut:tokens(CSS Syntax 3: strings, comments, escapes, url(), block stack; one shared lexerwalk()for declarations AND the rule cut),naive(complete comments dropped, split on every;, unterminated comment/string read on),plain(the old split). The frame is a cover when ANY reading says so; the old reading is a floor, nothing main caught is lost (property test over 20,000 random mixes: plain => union).url(recognised on the decoded identifier (u\72 l(,URL(,\55 RL(;\;url(is not url); CR, CRLF, FF normalised to newline; escapes consume hex digits plus one space.scanCsscut is brace-aware in thetokensreading (#x{content:"}";...},{/* } */ ...}), the first-}cut stays in the other two.)in url(), ident decode, newline preprocess, brace-aware cut, union,(?![\w%]), arithmetic flag, leading-dot number. Tokenizer vs a token-pre-pass recursive reference over 20,000 mixes.Round 6 (review of 4825783)
(?![\w%])lookahead is gone (100%x,100vwxfill, asincludesdid) and the lookbehind is(?<![\d.]); property test over 460,000 random attribute and stylesheet mixes (NUL, U+2028, BOM, NBSP, lone surrogates, escapes,\<LF>, at-rules): zero lists the old rules flag and the union does not (default 30,000 in the suite;OVERLAY_MIXES=460000for the big run). One deliberate exception:0.100vw(0.1 of a viewport) is not a cover, which the oldincludesrule called one.\<newline>outside a string is a stray token, not an escape; inside a string it continues it.url(quote check uses CSS whitespace (space, tab, newline) only.scanCsstokens reading runs preludes and at-rules through the same lexer:@media print{.x{content:"{"}},@import "a;b";,@import url(a;b);,@charset "a;b";,[a="{"],garbage;no longer hide the next rule.plainonly (removingplainfails),\<LF>hiding shape, NBSP/U+2028/BOM,.5vwandcalc(.5vw + 99.5vw), 99.99vw / 100.0001vw. Mutants killed: no plain,\<LF>, CSS whitespace, leading dot, old scanCss. (>=100vs>100is an equivalent mutant: the sum branch also accepts 100.)&{}nesting listed as a limit.Round 7 (tests + docs only)
Tests:
.5vhleading-dot height, form feed/newline inside a sheet string, comment-to-space in a prelude,{inside brackets (no rule, as in a browser), stray}before a rule,a;#g{...}(over-read: a browser may drop it in nested contexts, we read it; matters only for a fixed, high-z-index, auth-named iframe). Docs: CDO/CDC (<!--,-->) added to the limits. Skill change: none.