You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rules: 12 querySelector calls interpolate page ids/roles unescaped; quotes in an id throw 'Attribute selector didn't terminate' #1276
Twelve rule call sites build CSS attribute selectors by interpolating page-controlled values without escaping, e.g. doc.querySelector(\label[for="${id}"]`). An id(orrole, etc.) containing ", ` or ] makes the selector invalid. The rule then throws Rule error: Attribute selector didn't terminate, which is reported as a fail. Values that parse but mean something else can also match the wrong element silently.
a11y/duplicate-id-aria already avoids this with a one-pass id map. Its comment explains why: CSS.escape isn't available in the compiled binary, and quotes or brackets break the selector either way. The other call sites weren't updated:
Seen in a ~38k-site batch on v0.0.141: one site's form produced Rule error: Attribute selector didn't terminate from 4 of these rules at once.
Acceptance Criteria
No rule interpolates a page-controlled value into a selector string. Ids go through a shared lookup (an id map, or a getAttribute comparison); a safe escaper that runs in the compiled binary is acceptable if one is added to parser/utils.
A test feeds each listed rule a form whose id/for values contain ", \, ] and a space. Each rule evaluates normally with no Rule error:, and labels still associate correctly.
A guard test (or lint) fails when a new querySelector(\...="${...}"...`)with a page-derived value is added underpackages/rules/src`.
Activity
fix(parser,rules): update tests and dom-size for the empty-shell pars…
test(rules): selector guard traces variables without building a regex…
fix(parser,rules): pages with no markup parse to an empty shell; id/f…
fix(parser,rules): update tests and dom-size for the empty-shell pars…
test(rules): selector guard traces variables without building a regex…
nc9 commentedon Oct 30, 2026
Fixed in v0.0.142 (73780351), via the stacked release PR #1331.