Repository navigation
fix(cli): squirrel audit --offline checks nothing on another site #807 - #816
Conversation
0fd46e9 to
5cede7d
Compare
|
Review of #816 ( I read the diff and the surrounding
Correctness: No blocking issues. |
…#807 The asset phase status-checked third-party scripts, stylesheets and fonts (reliability/broken-resources) and sitemap URLs on other hosts whatever --offline said: the probe was gated only on the rule. A new ResourceCheckOverrides.ownSiteOnly, set by --offline, skips both; the rule reads third-party resources as not measured. Signed-off-by: Nik Cubrilovic <[email protected]>
…e run skipped #807 Review round 1: the --offline copy no longer claims zero off-site requests (redirects and robots.txt sitemaps on another host still reach it), the skipped off-site sitemap URLs get an info row instead of a silent pass, and pages with no third-party reference no longer read as unmeasured. Signed-off-by: Nik Cubrilovic <[email protected]>
…s when all were off-site #807 Review round 2: off-site sitemap URLs are dropped before the status cap under --offline, so they cost own-site URLs no slot and the count is complete; sitemap-4xx is skipped rather than passed when every URL was off-site; copy says 'another site' and names page and asset redirects; completions match the help text; the engine test drives both rule runners. Signed-off-by: Nik Cubrilovic <[email protected]>
…807 CodeQL js/incomplete-url-substring-sanitization: a bare endsWith('example.org') also matches notexample.org. Signed-off-by: Nik Cubrilovic <[email protected]>
f9f1890 to
2674c0e
Compare
|
Review of #816 ( I read the diff and did not run the tests. I found no blocking problems. The change is small and gated on
Tests cover both runners (v1 and streaming), the control case, the no-third-party-reference case and the rule's skipped/info rows. The docs, changelog and shell completions are updated to match. |
Closes #807.
What changes
squirrel audit --offlineis documented to leave out cloud features and checks of other sites. The asset phase still status-checked two kinds of URL on other hosts:reliability/broken-resources, New rule: broken scripts, stylesheets and fonts (no render needed) #703), gated only on that rule being enabled;ResourceCheckOverridesgainsownSiteOnly, and the CLI sets it for--offline. With it set:externalAssetsis absent andreliability/broken-resourcesreports "third-party resources were not measured this audit" in itsunchecked-resourcesnote, with nobroken-resourcesrow. When the pages reference no third-party resource at all,externalAssetsis empty instead, so nothing reads as unmeasured;crawl/sitemap-4xxsays how many it skipped on a new info row,sitemap-off-site-not-checked("{count} sitemap URL(s) on another site not checked this audit"), instead of a silent pass; when every URL to check was off-site,sitemap-4xxitself is skipped ("No sitemap URL on the audited site to check"), not passed. The count travels as an optionalsitemapOffSiteSkippedon the site data, set by the asset phase and carried by both rule runners.The audited site's own assets, subdomains included, and the internal link check are unchanged. External links were already off under
--offline.What
--offlinestill does not coverRequests to the audited site can still end up on another host when the site sends them there: a page or asset redirect (the soft-404 confirmation re-fetch included), or a sitemap file that robots.txt lists on another host. The copy (CHANGELOG,
cli/audit, the--offlinehelp text and completions) says so rather than promising zero off-site requests. Holding those hops to the site, and one definition of "own site" for assets and sitemap URLs, is #819. A related custom-header leak across the soft-404 confirmation's redirect, not specific to--offline, is #820.Tests
apps/cli/tests/commands/audit-offline-third-party-wiring.test.tsrunssquirrel audit https://example.com/ --offlinethrough citty's real parser, with a stubbed fetch. The page loads a stylesheet and a script from third-party hosts. No request reaches them, checked by URL and byHostheader, since a pinned request carries the name inHost. Fails on main.packages/audit-engine/tests/offline-own-site-only-807.test.tsmakes no network request: the third-party references and the off-site sitemap URL are on.invalid, refused on the URL alone. It runs the asset phase, then the rules through the real runners.ownSiteOnly: no third-party probe,reliability/broken-resourcessays they were not measured and emits nobroken-resourcesrow; pages with no third-party reference get an emptyexternalAssetsand no such note.ownSiteOnly, through bothrunRulesOnStorageandrunStreamingRules: the off-site sitemap URL is not checked, andcrawl/sitemap-4xxis skipped with the info row. Removing the threading line from either runner fails its case (checked).packages/rules/tests/sitemap-4xx-off-site-807.test.ts: the info row beside a pass, the skip when every URL was off-site, the unchanged pass with nothing skipped, and no row at 0 or absent.Also re-run:
rate-limited-links,asset-egress-2764,self/completion. tsgo is clean for rules, the engine and the CLI; oxfmt/oxlint pass on the changed CLI file;tangly check --strictpasses.Docs and skill
cli/auditsays what--offlineleaves out, and what it does not hold back.rules/reliability/broken-resourcesnotes the offline case;rules/crawl/sitemap-4xxdocuments the skip and the new info row.