Repository navigation
fix(crawler): ignore noscript meta refresh when resolving the seed - #561
Conversation
findClientRedirects scanned raw HTML with no notion of <noscript>, so a meta refresh a browser never runs re-seeded the crawl at the no-JS page. Strip noscript markup before scanning. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Reviewed the diff. I found no correctness, security or performance problems.
|
|
Review of #561 (ignore client-side redirects inside No blocking findings. The change is small and reuses the existing
Overall this looks good to merge. |
Signed-off-by: Nik Cubrilovic <[email protected]>
|
Reviewed the diff and the existing
I didn't run the tests myself. I'm relying on the results in the PR description. |
What changed
findClientRedirectsscanned raw HTML for meta refresh tags with no notion of<noscript>. A browser with scripting on reads<noscript>content as text, so that refresh never fires, but the crawler treated it as a redirect and re-seeded the audit at the no-JS page.findClientRedirects(packages/utils/src/client-redirects.ts) now runsstripNoscriptMarkupover the HTML first. This covers the JavaScript redirect scan as well, since a script inside<noscript>does not run either.docs/crawl.mdxnotes that client-side redirects inside<noscript>are ignored.Acceptance criteria
findClientRedirectsignores a meta refresh inside<noscript>. Tests inpackages/utils/tests/client-redirects-noscript.test.ts:ignores a meta refresh inside <noscript>, plus an uppercase multi-line variant.<noscript>is still followed, with a test for each case. Same file:negative control: a meta refresh outside <noscript> is still followed,a meta refresh outside <noscript> wins when the page also has one inside,a meta refresh after a closed <noscript> is still followed.<noscript>meta refresh is audited at the seed URL.packages/crawler/tests/seed-noscript-meta-refresh.test.tsruns the realcrawler.start()against a local server: the seed URL and page are kept and the fallback page is never stored. Its negative control (the same refresh outside<noscript>) re-seeds at/no-js.html.Verification
bun test packages/utils/tests/client-redirects-noscript.test.ts: 5 pass (3 fail with the fix reverted)bun test packages/crawler/tests/seed-noscript-meta-refresh.test.ts: 2 pass (the seed test fails with the fix reverted)bun teston seed-redirect-pinning, redirect-header-security, apps/cli client-redirects: 64 passbun run typecheckin packages/utils and packages/crawler: cleanbun run lint,bun run format:check: cleancd docs && make validate: all checks passedAgent skill
No skill change needed. No CLI flag, output or command changed.
Closes #437