Repository navigation
Description
Auditing a link-shortener URL (or any start URL that redirects to another registrable domain) audits the shortener's own page and reports it as a normal completed audit with a score:
squirrel audit https://bit.ly/<code> -C surface --max-pages 2 --offline --passive -f json -o r.json
# Auditing https://bit.ly/<code> / New crawl: https://bit.ly / Audited 1 pages
# r.json: status "completed", meta.baseUrl "https://bit.ly", totalPages 1, score.overall 37
A cloud run (--render-mode all --ephemeral, v0.0.141) gives the same result: completed, base URL https://bit.ly, 1 page, score 37.
#1224 settled that --offline doesn't follow an off-site seed redirect, by design, and that the run should disclose "Seed redirected off-site to ..., not followed". Neither JSON report has that note or names the destination, and the score is presented as the site's. In a ~38k-site batch of product launches, 629 launch URLs (1.6%) redirected to another domain. The batch only got the right audit because it resolved redirects itself before calling the CLI.
Proposed behaviour (decided with the maintainer, 2026-10-29)
Nobody who types squirrel audit bit.ly/x wants a score for bit.ly. Resolve the start URL's redirect chain before crawling, and make the final URL the audit target, with the user's consent when it changes site:
- Same-site redirects (http→https, apex↔www, a path change on the same registrable domain): follow silently; the final URL is the target.
- Cross-domain redirects (shorteners, launch domains forwarding to the product, moved domains): need consent, because they change which site gets crawled.
- Interactive TTY: prompt
bit.ly/x redirects to https://example.com/pricing. Audit example.com instead? [Y/n]. - Non-interactive (agents, CI):
--follow-redirect(and[crawler] follow_redirect = trueinsquirrel.toml). Without it, don't audit the redirector. Exit with a distinct statusredirectedwhose report names the final URL and the exact command to re-run. -ydoes not imply it:-yapproves credit spend, and agents pass it routinely. Following an off-site redirect is a separate consent, since it may be a third-party site.- MCP
run_audit: reuse theconfirmation_requiredhandshake and show the final URL with the estimate;confirm: trueplusfollow_redirect: trueproceeds. - Known shorteners (bit.ly, t.co, lnkd.in, …) may get lighter prompt copy, but still need consent.
- Interactive TTY: prompt
- Credits are estimated against the final site, after resolution.
- Every hop and the destination go through the existing egress/SSRF guards (no private IPs;
--offlineegress rules apply to crawling, but the seed chain is resolved with one request per hop). Cap the chain at 5 hops; a loop or the cap reportsredirectedwith the chain so far. - The report records the original URL and the full chain. The crawl scope is the destination's domain. In the cloud, the website row belongs to the final domain, with the original URL kept as an alias, so
bit.ly/xnever becomes a dashboard website.
Acceptance Criteria
- A same-site seed redirect is followed without a prompt, and the report's base URL is the final URL.
- A cross-domain seed redirect prompts on a TTY. Accepting audits the destination (report records the original URL and chain); declining exits with status
redirectednaming the final URL. - Non-interactive without
--follow-redirect: no crawl of the redirector and no score. Exit with theredirectedstatus (its own exit code, documented) and a report naming the final URL and the re-run command. With--follow-redirect: the destination is audited. -
-yalone does not follow an off-site seed redirect; a test pins it. - MCP
run_auditreturnsconfirmation_requiredwith the final URL for a cross-domain seed, and proceeds only with explicit follow consent. - The credit estimate uses the destination site.
- Each hop passes the egress/SSRF guard (test: a redirect to a private IP is refused and reported). Chain capped at 5 hops; loops are reported.
- In the cloud, the website is created under the final domain, with the original URL stored as an alias.
- The text, markdown, LLM and JSON outputs carry the original URL and chain. Docs (
docs/cli/audit.mdx, MCP docs, exit-code table) and shell completions are updated in the same PR, and the agent skill is checked for a needed change. - A test covers a shortener-style seed (
301to another domain) offline and online, plus a same-sitehttp→https→wwwchain.
Activity
[-]Auditing a shortener URL (bit.ly etc.) audits the shortener: 'completed', score 37, base URL bit.ly, no off-site redirect disclosure[/-][+]Start URL redirects (bit.ly etc.): resolve the chain and audit the destination, with consent for cross-domain (--follow-redirect / prompt); today it scores the shortener[/+]fix(cli): redact start-redirect URLs, treat any off-site hop as cross…
test(cli): build userinfo fixtures at runtime for the secret scan (#1281
test(cli): let the redirect probe through the MCP billing shutdown ga…
test(cli): the redirect prompt echoes origin and path only (#1281)
fix(cli): no replacement-pattern splice in the redirected message; do…
feat(cli): audit follows start-URL redirects with consent #1281
nc9 commentedon Oct 30, 2026
Checked against main (23a34c1, v0.0.144). Ticked what holds (the resolver, consent, exit code 4, outputs, docs). Open: the cloud criterion (a website alias or stored original URL) is not implemented; the audit URL is the destination and the original appears only in report meta. No test asserts the credit estimate uses the destination in the MCP
audit_websitepath, and the only end-to-end run is--offline, so there is no online-mode e2e.nik
test(cli): start-URL redirect is estimated and registered as the dest…
test(cli): parse hostnames instead of substring match (CodeQL); retit…
test(cli): start-URL redirect is estimated and registered as the dest…
test(cli): parse hostnames instead of substring match (CodeQL); retit…
nc9 commentedon Oct 31, 2026
Re-checked against main after v0.0.148 (the redirect estimate, registration and online-mode e2e landed). Met locally: following a same-site redirect silently, the cross-domain prompt and exit 4 with the re-run command,
-yalone not following, the MCPconfirmation_requiredoutcome, the SSRF guard on each hop and the cap of 5, and the shortener e2e offline and online. Open: the criterion that the credit estimate uses the destination holds only by ordering (the estimate takes no site input) and no test asserts it; the hosted alias for the original URL is not in this repo; the agent skill check is a process item; and thehttptohttpstowwwchain is a resolver unit test, not an e2e. Leaving this open for those.nik
test(cli): the #1281 cross-domain redirect MCP test gets an explicit …
test(cli): the #1281 cross-domain redirect MCP test gets an explicit …
nc9 commentedon Nov 11, 2026
The CLI side is on main: resolver, consent,
--follow-redirect, exit 4 with the re-run command, the per-hop egress guard, the 5-hop cap, and the estimate/registration/billing on the destination (audit-website-billing.test.ts). End-to-end chain, cap and loop tests are in the next release. What is left is the hosted website record (final domain plus alias), tracked privately; this closes when that ships.nik
test(cli): start-URL redirect chains end to end: a three-hop same-sit…
nc9 commentedon Nov 12, 2026
Not closed after v0.0.179 (https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.179). The local flow (same-site follow, TTY prompt, exit 4,
-y, MCP confirmation, egress guard, hop cap) shipped with tests. Still open: the cloud website created under the final domain with the original URL as an alias (private), and the agent-skill check. The change that shipped is db66007.nik
test(cli): e2e for a start-URL hop the egress guard refuses #1281
test(cli): e2e for a start-URL hop the egress guard refuses #1281
Merge remote-tracking branch 'origin/main' into docs/agent-setup-v2