Skip to content

fix(cli): probe sends [crawler] user_agent and falls back to the honest UA on resets #2140 - #2142

Merged
nc9 merged 3 commits into
mainfrom
fix/probe-user-agent-2140
Nov 19, 2026
Merged

nc9 merged 3 commits into
mainfrom
fix/probe-user-agent-2140

Conversation

@nc9

@nc9 nc9 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Closes #2140

What changed

  • The reachability probe sends [crawler] user_agent (or a custom User-Agent header) like the crawl; initRequestTool carries it to the rules' own requests too. Chrome client hints (sec-ch-ua*) are only sent with a Chrome UA.
  • A connection reset or HTTP/2 protocol error on the default browser UA triggers ONE attempt as SquirrelScan/2.0 (+https://squirrelscan.com). Decision: one reset already shows the pattern, so the same failing headers are not retried first. If the honest UA answers, the whole crawl runs as it, with one stderr line and a report note (userAgentFallback, JSON schema 1.29, shown as a line in text and markdown). If it also fails, the run stops without more retries.
  • A UA the user configured is never replaced by the fallback.
  • Unreachable message: connection reset by the site: it may block browser-like clients. Set \[crawler] user_agent` in squirrel.toml (see https://docs.squirrelscan.com/configuration/crawler)`.

Acceptance criteria

  • Probe sends the crawl's UA: the probe > sends the configured UA and does not fall back
  • Reset then honest UA answers, crawl continues as honest, one line + report: the audit > crawls the whole site as the honest UA, says so once, and the report carries it, the probe > falls back once...
  • Configured UA audits a resetting site: the audit > with [crawler] user_agent set...
  • New unreachable wording: the probe > names the cause and the fix..., the audit > a site that resets every client fails with the new wording
  • Tests use a local TCP server, fail-before verified (all 6 fail with the source reverted)
  • Docs: docs/configuration/crawler.mdx user_agent section, output.mdx schema 1.29, changelog.d entry; make validate in docs/ passes

Gates

test-suites.ts --check ok; --run cli 4565 pass 0 fail; --run crawler 1176 pass 0 fail; --run report 1413 pass 0 fail; typecheck cli/report/core-contracts clean; root lint and format:check clean; changelog.ts check ok; docs make validate 71 pass.

Notes

  • Without a configured UA the probe sends the request tool's default browser UA, not the project's pinned one: the pin is read from storage, which opens after the probe.
  • The agent skill needs no change now: it only lists a reset as an unreachable cause, and the CLI now handles it and names the fix. Revisit after release.

…st UA when a site resets browser-like clients #2140

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as ready for review November 19, 2026 22:53
nc9 added 2 commits November 20, 2026 09:56
… audit

effect <=3.22.0 ReDoS in Schema.TemplateLiteral's compiled regex. squirrel never uses Schema.TemplateLiteral, so it is not exploitable here. Temporary, decided by the maintainer so the CLI fix ships today: #2143 (effect 3.22.5) removes this ignore and its allowlist section when it merges after the v0.0.189 release.

Signed-off-by: Nik Cubrilovic <[email protected]>
…-UA attempt is reset (pub#2140 review)

A single transient reset that a retry clears no longer switches the whole crawl's agent: the browser UA keeps its transient retries, and the honest SquirrelScan UA gets its one attempt only when all of them ended in a reset or protocol error. New test: a server that resets only its first connection gives no fallback. The reset-every-time case still finishes inside the 20 s probe budget (asserted). Fail-before: on the previous order the new test and the two updated sequence tests fail.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 merged commit 28bf76f into main Nov 19, 2026
16 checks passed
@nc9
nc9 deleted the fix/probe-user-agent-2140 branch November 19, 2026 23:14
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.

CLI: audit fails 'Cannot reach … ECONNRESET' on sites that reset browser-like clients; probe ignores [crawler] user_agent

1 participant