Verify hosts are alive before emitting wayback URLs - #3359
Open
liquidsec wants to merge 1 commit into
Open
Conversation
Probe each scheme/host/port once with HEAD / before emitting URL_UNVERIFIEDs, caching verdicts in a bounded (~10MB) LRU. Dead hosts still populate the archive cache, since fetching their snapshots is what that feature is for.
liquidsec
added a commit
that referenced
this pull request
Jul 30, 2026
Contributor
📊 Performance Benchmark Report
📈 Detailed Results (All Benchmarks)
🎯 Performance Summary! 1 regression ⚠️
30 unchanged ✅🔍 Significant Changes (>10%)
🐍 Python Version 3.11.15 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3359 +/- ##
=====================================
- Coverage 90% 90% -0%
=====================================
Files 450 450
Lines 46327 46387 +60
=====================================
+ Hits 41588 41632 +44
- Misses 4739 4755 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
urls=True, wayback emits aURL_UNVERIFIEDfor every URL that survives filtering, with no check that the host still exists. A CDX response for a large domain routinely contains hundreds of hosts that are long dead, and every one of their URLs gets emitted for the rest of the scan to chase:httprequests each one, excavate parses the results, the spider follows them. That cost is large and entirely wasted.Nothing in the emission path checked liveness.
_pre_process_urlsapplies an in-scope test, but only for the archive/parameter/interesting-file metadata; theURL_UNVERIFIEDlist bypassed it.abort_ifruns after DNS resolution but only requires thein-scopetag, which an unresolvable host still carries.Change
Probe each
(scheme, netloc)once withHEAD /before emitting any of its URLs, and drop the URLs of hosts that don't answer.request_batch_streamat 25 concurrency,follow_redirects=False, so it's one request per host regardless of URL count.retries=1rather than inheritingweb.http_retries, so a single dropped packet can't condemn a live host even if a user sets that to 0.LRUCache(maxsize=40000), measured at 9.44 MB when full with realistic hostnames (248 bytes/entry).Only reachable from the
urls=Truebranch, so the default config sends no probes.The archive path is deliberately unaffected
_archive_cacheis populated before the liveness gate. Dead hosts are exactly what the archive feature exists for, sofinish()still fetches every snapshot it would have before. Eviction behavior is unchanged too: it only fires on a live 2xx URL event, which a dead host never produced anyway. The six existing archive tests all run againsthttp://127.0.0.1:1/..., i.e. dead hosts, and pass unchanged._parameter_cacheis now only populated for live hosts. Those entries could only ever be read when a live 2xx URL event arrived, so nothing is lost.Tests
New
TestWaybackDeadHostSkip: two hosts with identical DNS, only one answering HTTP. Asserts only the live host's URLs are emitted, that the host is probed exactly once regardless of URL count, and the resulting cache contents.Seven existing tests needed a liveness mock, since their hosts are mock-intercepted and an unmatched URL now reads as dead.
TestWaybackParametersgot an explicit/handler rather than relying on the httpserver's 500-fallback.20 passed, 0 failed.
Notes
httpwould have failed the same connection.urls=Truewhile it's still flaggedpassive. That's a pre-existing inconsistency (_is_http_wildcard_hostalready probes targets in every config) and is tracked separately in Module flags are static, but some modules are active or passive depending on config #3358 rather than fixed here.