Skip to content

harden(audit): apply the URL policy to sitemap discovery fetches - #192

Open
eeshsaxena wants to merge 1 commit into
every-app:mainfrom
eeshsaxena:harden/sitemap-url-policy
Open

harden(audit): apply the URL policy to sitemap discovery fetches#192
eeshsaxena wants to merge 1 commit into
every-app:mainfrom
eeshsaxena:harden/sitemap-url-policy

Conversation

@eeshsaxena

Copy link
Copy Markdown

What

Sitemap URLs discovered during an audit come from the target's robots.txt (robots.getSitemaps()) and from nested <sitemap><loc> entries, so they are controlled by the audited site rather than by us. fetchSitemapDocumentWithRetry fetched them after only normalizeUrl, without the isCrawlableUrl policy check that start URLs (normalizeAndValidateStartUrl) and mid-crawl links (siteAuditWorkflowCrawl) already pass through.

Change

Apply isCrawlableUrl at the top of fetchSitemapDocumentWithRetry, before the fetch. Every sitemap, including nested ones (which are re-fetched through the same function), passes this single check, so a sitemap can't point the crawler at private / loopback / metadata hosts. isCrawlableUrl is already covered by url-policy.test.ts.

Keeps the URL policy consistent across all three fetch entry points (start URL, mid-crawl links, and sitemap discovery).

Sitemap URLs come from the target's robots.txt (robots.getSitemaps) and from
nested <sitemap><loc> entries, so they are attacker-controlled, but
fetchSitemapDocumentWithRetry fetched them without the isCrawlableUrl check
that start URLs and mid-crawl links already go through. Apply the same policy
here so a sitemap can't point the crawler at private/loopback/metadata
addresses. Every sitemap (including nested ones) is fetched through this
function, so one check covers the whole path.
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.

1 participant