Repository navigation
feat(rules): mobile/web-app-manifest checks the linked manifest and its icons (#710) - #715
Conversation
|
Reviewed the diff only: I did not run the tests or typecheck. The design is sound. Each manifest is fetched once, fetching is bounded by
I found no critical or high-severity issues. |
Maintainer review (2026-10-12)Verdict: needs fixes (medium). I reviewed head b1f4a1f against main at 2dca3b9. Main CI is green at that sha, so the red checks come from this PR. Acceptance criteria (#710)11 of 13 are met, by AC1 and AC2 are only partly met. The check status is Fixes
PR hygiene
Merge order |
Auto-review did not completeThe
Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal): Show partial reviewYou've hit your session limit · resets 10:10pm (UTC) |
…ts icons #710 A site-scope rule for the web app manifest the pages link. The engine fetches each same-site manifest once, through the script fetcher's caps and timeouts, and checks each icon it declares with the resource checker's image header read. The rule judges the result: - error when the manifest answers 4xx/5xx or is not a JSON object (meta severity error, so the report shows it as one; warn-only results stay warnings) - warn on a content type other than application/manifest+json or application/json, on missing name/short_name, start_url or display, on a start_url on another origin, on no 192px or 512px PNG icon, on an icon that answers 4xx/5xx, on a declared size that differs from the real one, and on a hex theme_color that matches no linking page's hex theme-color (rgb(), hsl() and named colours are not compared) - info, not checked, when the manifest or an icon was throttled or answered by a WAF challenge, or redirects off the site; info counting icons on another origin, manifests past the per-site cap of 5, no maskable icon, and no linked manifest Every manifest and icon hop is held to the site's host and subdomains by an egress policy (new `allowHost` in @squirrelscan/utils/public-egress, and an `egress` option on the script fetcher): a same-site manifest that redirects elsewhere is not followed there, link-local and metadata addresses are refused, and private addresses are allowed only for the site's own origin (new `allowPrivateTarget`) or a site that is itself private: a public site's subdomain, or another port on its host, that resolves privately is not fetched. The fetch runs only while the rule is enabled. Site-controlled text in messages is cut at 120 characters; at most 200 icon entries are read. A relative manifest link resolves against `<base href>`. A refused manifest fetch is recorded in the fetch budget as an answer (as tarpit strike, so refused icons or missing manifests cannot mark the audited host as tarpitting. Relative start_url and icon src resolve against the manifest URL. One check per manifest URL, listing every page that links it. The script fetcher gains an opt-in anyContentType flag so the JSON body is kept; its default is unchanged. Docs page under docs/rules/mobile/ and a nav entry. Golden gate: +1 finding and +1 tally row (info: the harness's empty assets carry no manifest data); healthScore.overall stays 51. Signed-off-by: Nik Cubrilovic <[email protected]>
d706a29 to
3804a59
Compare
|
Review of #715 (mobile/web-app-manifest). I read the engine changes ( The design is sound:
Findings:
No blocking issues found. |
|
On the review's low finding (custom headers reaching a same-site subdomain): the manifest and icon fetches send them no further than main's asset fetches already do. Redirects are handled more strictly. Code on main is at 7d772c1, and this PR's code is at 3804a59. Main already sends custom headers to subdomain assets.
So on main, What this PR adds, compared with that:
Limiting custom headers to the exact origin only for manifests and icons would make them the one asset kind treated differently from scripts, CSS, images and fonts. If the policy should be exact-origin, it needs one change across every asset pool, which is a behaviour change to #494 and should be its own issue. I'm leaving this PR as is. |
Summary
Adds the site-scope rule
mobile/web-app-manifestfor the web app manifest the pages link (<link rel="manifest">).packages/audit-engine): the page collector records each same-site manifest link and the theme-color metas of the pages that carry it. Each manifest is fetched once through the script fetcher's caps and timeouts. Each icon the manifest declares is checked through the resource checker's image-header read, so the real pixel size comes back. The script fetcher gains an opt-inanyContentTypeflag so the JSON body is kept. Its default is unchanged, so script callers keep their JS-only gate.packages/rules/src/mobile/web-app-manifest.ts): one check per manifest URL, listing every linking page. Its status is the worst problem, and each problem is an item. Relativestart_urland iconsrcresolve against the manifest URL.docs/rules/mobile/web-app-manifest.mdx, a card on the mobile index, and a nav entry indocs/docs.json.Not reported here, per the issue: missing apple-touch-icon or favicon (
core/favicon), and theme-color differences between pages (social/asset-divergence).Changes from the maintainer review (2026-10-12), and from two Opus security passes on the fetch:
healthScore.overallstays 51.meta.severityiserror, so a manifest that 404s or is not JSON reports as an error; warn-only results stay warnings. Docs table updated.start_url, content type,theme_color, icon URLs, origins) is cut at 120 characters.Retry-After) or a WAF challenge is not checked, never a broken icon or an error.web-app-manifest-uncheckednote; icons on another origin and icons past the first 20 are counted as not checked;theme_coloris compared only when both sides are hex; SVGsizes: "any"behaviour documented; at most 200 icon entries are read.<base href>(Angular), and non-http manifest links are dropped.allowHostin@squirrelscan/utils/public-egress, anegressoption on the script fetcher): a same-site manifest that redirects to another host is not followed there and reads as not checked; link-local and metadata addresses are refused; private addresses are allowed only for the site's own origin (newallowPrivateTarget) or a site that is itself private, so a public site's subdomain or another port that resolves privately is not fetched. Custom headers go only to the site (as for the other same-site assets). The fetch runs only while the rule is enabled.::1-only dev servers this review also found was backported into feat(rules): add reliability/broken-resources and the Reliability category #703 #714.)[Unreleased]/### Added.Agent skill: yes, the squirrelscan agent skill (squirrelscan/skills) should learn the new rule; the maintainer files that as a private issue. Per-category counts (Mobile 6 -> 7) are left for the maintainer's batched docs PR.
Closes #710
Verification
The new rule, engine and test files are oxfmt- and oxlint-clean (the packages have no format or lint script of their own).
Checklist
Signed-off-byline (git commit -s).Acceptance checklist (#710)
/site.webmanifestthat returns 404 produces an error finding naming the manifest URL and the linking pages (rule test; engine test confirms the 404 status is kept)text/plainproduces a content-type warning;application/manifest+jsondoes not (rule test)nameandshort_name, missingstart_url, and missingdisplayeach produce a warning naming the field (rule test)512x512whose file is 256x256 produces a warning showing both sizes; a 404 icon produces a warning naming its URL (rule test and engine test with a real 256px header)srcandstart_urlare resolved against the manifest URL (helper test; engine test fetches/static/icon.pngfrom"src": "icon.png"in/static/m.json)theme-color#000with manifest#fffproduces a warning; a light/dark pair where one matches does not (rule test)maskableicon produces an info result, not a warning (rule test)<link rel="manifest">produces one info result and no score penalty (rule test for the info result; no penalty becausepackages/audit-engine/src/scoring.tsskipsinfoandskippedchecks, verified by reading the code, not by an end-to-end score run)apple-touch-iconis not reported by this rule (the rule never reads it)docs/rules/mobile/Known limits, not blocking:
HTTP_PROXY, a pinned plain-http request may reach the proxy's default vhost (documented in the egress guard).