Skip to content

fix(rules): crawl/robots-txt reports a wildcard Disallow: / that Googlebot or Bingbot is re-allowed past as robots-txt-disallow-wildcard - #1786

Closed
orshih6 wants to merge 5 commits into
squirrelscan:mainfrom
orshih6:contribot/issue-1783
Closed

orshih6 wants to merge 5 commits into
squirrelscan:mainfrom
orshih6:contribot/issue-1783

Conversation

@orshih6

@orshih6 orshih6 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

crawl/robots-txt only looked at the User-agent: * group. A file with User-agent: * / Disallow: / plus User-agent: Googlebot / Allow: / failed robots-txt-disallow ("robots.txt blocks all crawling"), although Google may crawl the site.

When the * group has Disallow: /, the rule now looks for a Googlebot or Bingbot group (matched without case). It asks the shared isRobotsTxtDisallowed matcher whether that crawler may fetch /. If one may, the rule emits robots-txt-disallow-wildcard (warn) instead, naming the crawlers still allowed in the value and the items. robots-txt-disallow keeps its meaning: it fails only when no named group re-allows a major search crawler. Groups for other bots, or a Googlebot group with its own Disallow: /, still give the failure. Only one of the two checks is emitted per run.

The rule now declares meta.checks (it is removed from rule-checks-undeclared.json). The robots-txt-disallow clean check clears both problem checks. robots-txt-disallow is still emitted, so its tracking key does not move and no supersededChecks entry is added. The rule page and the CHANGELOG describe both checks.

Tests: new packages/rules/tests/robots-txt-disallow.test.ts covers a wildcard-only block, a wildcard block with a Googlebot allow, a wildcard block with a named group for another bot, a named group that only disallows a subpath (case-insensitive), and the pass case. It also asserts that every emitted check is declared. Two of these cases fail without the change.

Ran: bun test on the new test file, robots-txt-crawl-delay, rule-check-declarations, and the rules/audit-engine tests that run this rule (131 pass), bun run typecheck in packages/rules, oxlint on the changed files, and bun run docs:check.

🤖 Generated with Claude Code

Fixes #1783


This change was prepared with an AI coding agent (Claude) and reviewed by me before submitting. I'm happy to make any changes you'd like.

…lebot or Bingbot is re-allowed past as robots-txt-disallow-wildcard

Signed-off-by: Бат-Орших <[email protected]>

nc9 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed head: 1fc677e

Verdict: pending maintainer review. No correctness bugs found. The change adds a new check name and moves some files from fail to warn, which is a scoring and severity decision for the maintainer. Thanks for the focused fix, tests and docs.

Findings, most severe first:

  1. Medium (design): a file with User-agent: * / Disallow: / and a Googlebot or Bingbot group that allows / now warns as robots-txt-disallow-wildcard instead of failing robots-txt-disallow (packages/rules/src/crawl/robots-txt.ts, crawlersStillAllowed and the new if (stillAllowed.length > 0) branch). That matches the report in the PR body and reuses the shared isRobotsTxtDisallowed matcher, so group selection follows the same rules as the rest of the engine. Whether this should be a warn, and whether only Googlebot and Bingbot should count, is the maintainer's call.
  2. Low: the new branch runs before the existing "Disallow: / with Allow exceptions" info path, so a * group that has both Disallow: / and Allow rules, plus an allowed Googlebot group, now warns rather than reporting info. That looks intended, but there is no test for that combination.
  3. Low: meta.checks is now declared and the rule is removed from rule-checks-undeclared.json, and the tests call expectDeclaredChecks. The robots-txt-exists "skipped" entry and the robots-txt-crawl-delay entry have no clean outcome; worth confirming against the rule's other branches that every emitted status maps to a declared outcome.
  4. Process: gh api shows no check runs on this head, and the PR is blocked, so CI probably needs a maintainer to approve the workflow run. Nothing has been verified by CI yet, and I did not run the tests.
  5. Conventions: DCO sign-off is present, CHANGELOG [Unreleased] entry is added, rule docs docs/rules/crawl/robots-txt.mdx are updated, no new runtime dependency. The CHANGELOG bullet is long for one line but fine.

nik

@nc9 nc9 added the needs-review label Nov 12, 2026 — with Claude
@nc9 nc9 removed the needs-review label Nov 12, 2026
…w exceptions, with and without a Googlebot group that allows /

Signed-off-by: Бат-Орших <[email protected]>
@orshih6

orshih6 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@nc9 thanks for the review.

2: I added two tests. One is * with Disallow: / and Allow: /public/ on its own, which still reports info. The other is the same group plus a Googlebot group with Allow: /. That one now warns as robots-txt-disallow-wildcard, and that is intended: Googlebot can crawl the whole site, so a finding that is only about the Allow exceptions would understate it.

3: I went through every branch. robots-txt-exists emits info when there is no robots.txt data or when the probe got no answer (timeout, budget cut, or refused). The rule didn't evaluate anything there, which is what skipped means, so that entry is used. The others are fail (file confirmed absent) and pass. robots-txt-crawl-delay only emits when a group has a Crawl-delay, as info or warn. When there is no delay it emits nothing, like robots-txt-size, so there is no clean check to declare for either. Syntax, disallow, disallow-wildcard and sitemap each map to a declared problem or clean entry. Each test also runs expectDeclaredChecks over all the checks the rule emits, not only the disallow ones.

I'll leave the warn-vs-fail call and the Googlebot/Bingbot list to the maintainer, and CI is waiting on workflow approval.

nc9 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed head: 2e52042

Verdict: pending maintainer review. The new commit is test-only and closes finding 2 of the last review; the design decision in finding 1 is still open.

Changes since the last reviewed head (1fc677e), one commit touching only packages/rules/tests/robots-txt-disallow.test.ts:

  1. Low, addressed: the two new tests cover the User-agent: * / Disallow: / / Allow: /public/ combination, once with no named group (stays info on robots-txt-disallow) and once with a Googlebot group that allows / (now warn on robots-txt-disallow-wildcard, value User-agent: * has Disallow: /; still allowed: Googlebot). That pins the behaviour I flagged as untested. I did not run them.
  2. Medium (design), still open: whether a wildcard block that Googlebot or Bingbot is re-allowed past should warn, and whether only those two bots count, is the maintainer's call (packages/rules/src/crawl/robots-txt.ts).
  3. Still open: finding 3 (confirm every emitted status maps to a declared meta.checks outcome) has no change in this commit.
  4. Process: no check runs are reported on this head, so CI probably needs a maintainer to approve the workflow run. Nothing has been verified by CI.

Conventions: DCO sign-off present on the new commit, no new dependency; CHANGELOG and rule docs were covered in the earlier review and are unchanged by this commit.

nik

nc9 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed head: 35ed92b

Verdict: pending maintainer review. The design decision from the earlier reviews (warn vs fail, and whether only Googlebot and Bingbot count) is still the maintainer's call, and the branch needs a rebase before anything else.

Changes since the last reviewed head (2e52042): three merge commits of main (6f7202f, e724c48, 35ed92b). Of the PR's own files only CHANGELOG.md differs from the last reviewed head; packages/rules/src/crawl/robots-txt.ts, the rule docs, the test file and rule-checks-undeclared.json are unchanged, so the earlier code findings stand and none of them were requested as changes.

Findings, most severe first:

  1. Medium: GitHub reports the PR as dirty (merge conflicts with main). The CHANGELOG hunk is the likely cause, as main keeps adding release sections there. It needs another merge or rebase before it can land.
  2. Medium (design), still open: whether a wildcard block that Googlebot or Bingbot is re-allowed past should warn (packages/rules/src/crawl/robots-txt.ts).
  3. Low: the CHANGELOG bullet says robots-txt-disallow "fails only when every crawler is blocked", but the PR body and the code say it fails when no Googlebot or Bingbot group re-allows the site. A group for another bot does not count, so the wording overstates it. Please make the bullet match the code. Also confirm the entry sits under the section for the next unreleased version after the merge.
  4. Process: no check runs exist on this head, so CI probably needs a maintainer to approve the workflow run. Nothing has been verified by CI, and I did not run the tests.

Conventions: DCO sign-off present on the merge commits, rule docs updated, no new runtime dependency.

nik

@nc9

nc9 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Landed in bundle #1799, rebase-merged to main.

nik

@nc9 nc9 closed this Nov 13, 2026
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.

crawl/robots-txt says every crawler is blocked when a named group re-allows Googlebot

2 participants