Skip to content

content/hidden-text: a CSS parser differential reads a stylesheet as hiding what a browser shows #679

Closed

Description

@nc9

Summary. content/hidden-text reads a stylesheet with an unquoted url( containing braces as hiding an element that a browser shows. The default-mode CSS rule parser (parseRules, scanDeclarations) treats {, } and ; inside an unquoted url(...), inside (/[ blocks, and after a backslash escape as structure, so the following rule is read wrongly.

Repro (HTTP mode, local fixture):

<style>.a{background:url(}.b{display:none}.c{)}</style>
<p class="b">Sixty or more characters of ordinary visible paragraph text go here, so the rule has something to flag.</p>

Actual: .b is read as display:none, so the paragraph counts as hidden text. In Chromium (getComputedStyle) .b is displayed: the unquoted url( swallows the braces as one token, so display:none never applies.

Same default-mode blind spot for \} escapes and } inside (/[ blocks. A strict mode that handles these (stepBlocks, skipUnquotedUrl in css-scan.ts) exists on the side branch wip/static-hidden-cascade-664-665 at ee5a5d6 and could be ported.

Acceptance Criteria

  • The repro fixture does not produce a hidden-text finding.
  • } and ; inside an unquoted url(...), inside (/[ blocks, and after a backslash escape are not read as structure.
  • A plainly written display:none rule still produces the finding, and existing hidden-text tests pass.
  • The scanner stays linear time on hostile input (a flood of (, [ or url( runs in well under a second).
  • A test row set derived from headless Chromium covers each construct.

Activity

  1. added
    bug
    P3
    size: S
    rules
    on Oct 11, 2026
  2. nc9 commented on Oct 12, 2026

    @nc9
    ContributorAuthor

    Fixed in # and merged to main. Every acceptance criterion is met per the PR description, with before and after evidence from the CLI on local fixtures, tests that fail on the old code, and review comments triaged. Criteria ticked.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bugrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions