Skip to content

fix TypeError when a hostless target is sorted against a /32 - #3391

Open
liquidsec wants to merge 1 commit into
devfrom
hostless-sort-sentinel
Open

fix TypeError when a hostless target is sorted against a /32#3391
liquidsec wants to merge 1 commit into
devfrom
hostless-sort-sentinel

Conversation

@liquidsec

Copy link
Copy Markdown
Collaborator

Fixes #3390

The hostless sort sentinel in Target.add() was (0, 0), but host_size_key() returns (size, str). An explicitly-masked single address has size 0, so batching a hostless entry (BLACKLIST_REGEX) with a /32 or /128 tied on the first element and compared 0 against a str:

ScanBlacklist("RE:test", "1.2.3.4/32")
# TypeError: '<' not supported between instances of 'int' and 'str'

Reachable with no user-written RE: at all, since the spider preset ships a blacklist regex:

bbot -t example.com -p spider --blacklist 1.2.3.4/32

Changes the sentinel to (0, ""). Hostless entries are dropped before the radix tree (_add returns early on host is None), so their sort position is irrelevant and only the type matters.

Adds a regression test covering /32 and /128 batched with hostless entries in a single add(), plus a mixed batch of every host form.

Comment thread bbot/test/test_step_1/test_target.py Dismissed
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90%. Comparing base (9d516e8) to head (90754a4).

Additional details and impacted files
@@          Coverage Diff          @@
##             dev   #3391   +/-   ##
=====================================
+ Coverage     90%     90%   +1%     
=====================================
  Files        454     454           
  Lines      46937   46949   +12     
=====================================
+ Hits       42196   42213   +17     
+ Misses      4741    4736    -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Report

Comparing dev (baseline) vs hostless-sort-sentinel (current)

📈 Detailed Results (All Benchmarks)

📋 Complete results for all benchmarks - includes both significant and insignificant changes

🧪 Test Name 📏 Base 📏 Current 📈 Change 🎯 Status
Bloom Filter Dns Mutation Tracking Performance 3.81ms 3.85ms +1.0%
Bloom Filter Large Scale Dns Brute Force 15.63ms 15.49ms -0.9%
Large Closest Match Lookup 359.58ms 374.44ms +4.1%
Realistic Closest Match Workload 195.93ms 198.19ms +1.2%
Event Memory Medium Scan 1403 B/event 1405 B/event +0.1%
Event Memory Large Scan 1527 B/event 1527 B/event +0.0%
Event Validation Full Scan Startup Small Batch 413.99ms 415.30ms +0.3%
Event Validation Full Scan Startup Large Batch 557.54ms 560.72ms +0.6%
Make Event Autodetection Small 26.51ms 26.65ms +0.5%
Make Event Autodetection Large 272.03ms 272.90ms +0.3%
Make Event Explicit Types 11.99ms 11.83ms -1.4%
Excavate Single Thread Small 4.500s 4.417s -1.8%
Excavate Single Thread Large 10.370s 10.316s -0.5%
Excavate Parallel Tasks Small 4.562s 4.484s -1.7%
Excavate Parallel Tasks Large 6.663s 6.668s +0.1%
Intercept Throughput Small 901.30ms 891.09ms -1.1%
Intercept Throughput Medium 889.67ms 891.45ms +0.2%
Dns Throughput Quiet 2.871s 2.840s -1.1%
Dns Throughput Loaded 1.878s 1.878s +0.0%
Dns Throughput Inherited 2.805s 2.624s -6.5%
Is Ip Performance 2.28ms 2.34ms +2.2%
Make Ip Type Performance 238.34µs 237.10µs -0.5%
Mixed Ip Operations 2.38ms 2.39ms +0.8%
Memory Use Web Crawl 1.0 MB 1.0 MB -1.0%
Memory Use Subdomain Enum 28.3 MB 28.3 MB +0.0%
Memory Use Deep Chain 5.0 MB 5.0 MB +0.0%
Memory Use Parallel Chains 13.3 MB 12.2 MB -8.5%
Scan Throughput 100 3.046s 2.882s -5.4%
Scan Throughput 1000 21.359s 22.554s +5.6%
Typical Queue Shuffle 5.40µs 5.37µs -0.7%
Priority Queue Shuffle 26.10µs 26.32µs +0.9%

🎯 Performance Summary

No significant performance changes detected (all changes <10%)


🐍 Python Version 3.11.16

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.

2 participants