Repository navigation
Conversation
…or/role lookups no longer build selectors #1270 #1276 Signed-off-by: Nik Cubrilovic <[email protected]>
…e; engine-level CLI test; broader selector guard #1270 #1276 Signed-off-by: Nik Cubrilovic <[email protected]>
… (CodeQL) #1276 Signed-off-by: Nik Cubrilovic <[email protected]>
This was referenced Oct 30, 2026
Closed
Closed
Contributor
Author
This was referenced Oct 30, 2026
nc9
added a commit
that referenced
this pull request
Oct 30, 2026
…ntBody test) and oxfmt of the content store Signed-off-by: Nik Cubrilovic <[email protected]>
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.
Fixes #1270
Fixes #1276
What
parseHTML(the one entry point inpackages/parser/src/dom.ts) never returns a root-less document. An empty, whitespace, comment-only, plain-text, JSON or bare-doctype body is reparsed inside<html><head></head><body>..</body></html>, as a browser reads it.document.head/document.bodyno longer throw, so the burst of bogusRule errorfails on one degenerate page is gone at the source, not patched per rule.packages/rules/src/shared/attribute-lookup.ts:labelsFor(doc, id)(one pass per document) andelementsWithAttribute(root, attr, value)compare attribute values as plain strings. All page-controlled selector interpolations now use them: form-labels, form-field-multiple-labels, select-name, aria-input-field-name, aria-toggle-field-name, aria-meter-name, aria-progressbar-name, aria-command-name, aria-required-parent, aria-required-children, security/form-captcha. Constant-keyed ones (roles, captcha field names) went through the same helpers so the guard has no exceptions.htmlas null ("corrupted state" error spam, page skipped); they now test== null.Tests (failing first, 27 of 43 failed before the fix)
packages/parser/tests/empty-document-1270.test.ts: parseHTML / parseDocument / parsePage over each degenerate body.packages/rules/tests/degenerate-pages-and-hostile-ids-1270-1276.test.ts: every enabled rule throughRuleRunner.runPageRuleson each degenerate body, asserts zeroRule error:checks; hostile ids (",\,], space, mixed) through each listed rule with labels still associating; a guard that fails when a rule interpolates a value into an attribute selector.apps/cli/tests/cli/audit-degenerate-pages-1270-e2e.test.ts: the real CLI over a site with plain-text, JSON, comment-only and bare-doctype pages: noRule error. Fails on main, passes now.#${}and.${}; the known constant interpolations are allowlisted by file and snippet.rules/tests/dom-size.test.ts,page-classifier/tests/featurize.test.ts).Notes
Rule error. A zero-byte200body is NOT audited: the engine drops any page whose html is the empty string (!page.htmlinparsePageRecord,getParsedPages,isAuditablePage), so it gets neither findings nor a not-evaluated entry. That is a separate gap, filed as audit: a 200 page with an empty body is dropped silently before the rules run #1314, and this PR does not claim to fix it.perf/dom-sizeno longer needs its "No document root found" skip (a root always exists); an empty body measures 0 nodes. Docs for the rule updated.squirrelscan/skills): no change needed.## [Unreleased]/ Fixed.