Repository navigation
Resolve excavated relative URLs against <base href> - #3522
Conversation
📊 Performance Benchmark Report
📈 Detailed Results (All Benchmarks)
🎯 Performance Summary✅ No significant performance changes detected (all changes <10%) 🐍 Python Version 3.11.17 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3522 +/- ##
=====================================
+ Coverage 91% 91% +1%
=====================================
Files 461 461
Lines 49625 49723 +98
=====================================
+ Hits 44769 44862 +93
- Misses 4856 4861 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
en0f
left a comment
There was a problem hiding this comment.
ParameterExtractor.process crashes on RAW_TEXT events (bbot/modules/internal/excavate.py, around lines 955–959)
What changed: excavate watches both HTTP_RESPONSE and RAW_TEXT. The PR moved the URL setup to the top of process(), so it now runs every time. That setup reads event.parsed_url (through _event_base_url and event.parsed_url.query), but RAW_TEXT events don’t have that attribute.
What happens: any RAW_TEXT event that matches a parameter rule now throws an AttributeError before a single parameter is handled. Before this PR, that code only ran when the form action was missing or relative, so parameters with full URLs in extracted text were still emitted.
Damage: the error escapes search() and handle_event, so excavate stops processing that whole event. The parameters are lost, and so is anything the later rules would have found in the same text (URLs, emails, DNS names). Text extracted from archived HTML or JS files would hit this.
Why CI missed it: no test sends a RAW_TEXT event containing form or link HTML.
Fix: guard it the way URLExtractor already does with hasattr(event, "parsed_url"), or build document_url/base_url only when it’s needed and the event has a URL.
|
Fixed in 7c43c55. The page and base URLs are now worked out only when a relative endpoint needs them; on events without a URL (RAW_TEXT), relative endpoints are skipped and full-URL parameters are emitted as before. Added a RAW_TEXT test. |
Excavate resolved relative references against the response URL and ignored
<base href>. On a page with<base href="/">and a link likeapp/page, every copy of the page at a nested path produced a deeper URL (/app/sub/app/page). On servers that return the same page for any path, this became an unbounded chain of nested URLs, each one crawled, screenshotted and scanned.Excavate now resolves relative URLs against the page's
<base href>when present, for both parameter extraction and URL extraction. Forms with no action still submit to the page URL, per the HTML spec. Location headers and cookies are unchanged.