Repository navigation
Description
A sitemap index that lists children on other hosts silently returns none of their URLs, and logs the loss as a cycle.
rewrite_url_host (crates/crawlberg/src/normalize.rs) discards the child's host, port and userinfo whenever it differs from the base, keeping only path and query:
if let Ok(parsed) = Url::parse(url_str)
&& parsed.host_str() != base.host_str()
{
let mut resolved = base.clone();
resolved.set_path(parsed.path());
resolved.set_query(parsed.query());
return resolved.to_string();
}resolve_child_sitemap_url (sitemap.rs) routes every absolute child through it, so with base https://example.com/sitemap-index.xml:
https://blog.example.com/sitemap.xml -> https://example.com/sitemap.xml
https://shop.example.com/sitemap.xml -> https://example.com/sitemap.xml
https://docs.example.com/sitemap.xml -> https://example.com/sitemap.xml
All three collapse to one key. The first is fetched; the others hit if !visited.insert(resolved.clone()) (sitemap.rs:467) and are dropped with skipping sitemap index tier: cycle detected (already visited) (:470).
Result: every URL those sibling sitemaps carried is never returned and never crawled, map() comes back empty or near-empty, and the log says "cycle detected" — which reads as correct behaviour. Nothing reports a problem.
This is pre-existing, not introduced by the open sitemap stack, but three things make it urgent now:
- PR fix(sitemap): resolve a relative <loc> against the sitemap URL after redirects #364 changes what the collapse targets, from the requested URL's host to the redirect target's host, so one redirect silently re-points every cross-host child.
- PR fix(sitemap): resolve a relative <loc> against the sitemap URL after redirects #364's test
map_keeps_absolute_index_children_on_the_host_the_index_redirected_toasserts the collapse is the desired behaviour, which pins it. - PR fix(sitemap): parse, normalize and deduplicate urlset <loc> entries #332 already declined to apply the host rewrite to urlset entries — its
~keepsays "without their host rewrite: an entry on another host is returned on that host". So the rewrite has already been judged wrong for entries while being left on the document-fetch path.
Decide the semantics rather than ratifying them by test. Either cross-host child sitemaps are allowed, in which case drop rewrite_url_host from resolve_child_sitemap_url and let the SSRF check gate the fetch; or they are not, in which case return None and log the refusal. Rewriting onto another host is the one option that both loses the siblings and issues a request the site never advertised.
Activity