Skip to content

Include git commit hash in version output for git checkouts - #3530

Merged
liquidsec merged 3 commits into
devfrom
git-commit-version
Oct 19, 2026
Merged

liquidsec merged 3 commits into
devfrom
git-commit-version

Conversation

@liquidsec

Copy link
Copy Markdown
Contributor

Closes #3520

When BBOT runs from a git checkout, __version__ is the static version from pyproject.toml (currently 3.0.2), so a dev checkout looks exactly like a release. Dev builds published to PyPI and Docker Hub already get a distinct version (e.g. 3.0.2.123rc) from the CI version step, so this only affects editable installs.

This adds bbot.__full_version__, which appends the short commit hash when the package is inside a git checkout:

  • Release install: 3.0.2
  • Git checkout: 3.0.2 (git:ac2cee8b0)
  • Git checkout with uncommitted changes: 3.0.2 (git:ac2cee8b0-dirty)

The hash comes from a single git describe --always --dirty --exclude=* call, which runs only when a .git exists next to the package (a directory or, in worktrees, a file). If git is missing or fails, it falls back to __version__.

__full_version__ is used in the CLI banner, --version, the scan's Ran BBOT ... trace line in debug.log, and a new BBOT version: ... INFO line at the start of every scan, so it also ends up at the top of scan.log. __version__ is unchanged and still used for the User-Agent, the nmap XML output, and the deps installer cache key, where a commit hash would be wrong or would force a reinstall on every commit.

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.24561% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91%. Comparing base (484cfb6) to head (8a45f6c).

Files with missing lines Patch % Lines
bbot/test/test_step_1/test_cli.py 97% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             dev   #3530   +/-   ##
=====================================
+ Coverage     91%     91%   +1%     
=====================================
  Files        463     463           
  Lines      49758   49811   +53     
=====================================
+ Hits       44890   44942   +52     
- Misses      4868    4869    +1     

☔ 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 git-commit-version (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 2.92ms 2.93ms +0.5% ⚪ ✅
Bloom Filter Large Scale Dns Brute Force 11.78ms 12.01ms +2.0% ⚪ ✅
Large Closest Match Lookup 256.36ms 262.57ms +2.4% ⚪ ✅
Realistic Closest Match Workload 144.00ms 141.06ms -2.0% ⚪ ✅
Event Memory Medium Scan 1402 B/event 1402 B/event +0.0% ⚪ ✅
Event Memory Large Scan 1527 B/event 1524 B/event -0.2% ⚪ ✅
Event Validation Full Scan Startup Small Batch 320.10ms 315.89ms -1.3% ⚪ ✅
Event Validation Full Scan Startup Large Batch 408.48ms 402.43ms -1.5% ⚪ ✅
Make Event Autodetection Small 16.63ms 16.08ms -3.3% ⚪ ✅
Make Event Autodetection Large 166.57ms 160.99ms -3.4% ⚪ ✅
Make Event Explicit Types 6.83ms 6.66ms -2.5% ⚪ ✅
Excavate Single Thread Small 3.051s 2.957s -3.1% ⚪ ✅
Excavate Single Thread Large 7.829s 7.653s -2.2% ⚪ ✅
Excavate Parallel Tasks Small 3.215s 3.114s -3.1% ⚪ ✅
Excavate Parallel Tasks Large 4.816s 4.745s -1.5% ⚪ ✅
Intercept Throughput Small 783.39ms 783.15ms -0.0% ⚪ ✅
Intercept Throughput Medium 771.91ms 774.14ms +0.3% ⚪ ✅
Dns Throughput Quiet 1.964s 1.957s -0.3% ⚪ ✅
Dns Throughput Loaded 1.357s 1.359s +0.1% ⚪ ✅
Dns Throughput Inherited 1.714s 1.830s +6.8% ⚪ ✅
Is Ip Performance 1.75ms 1.76ms +0.3% ⚪ ✅
Make Ip Type Performance 159.05µs 156.87µs -1.4% ⚪ ✅
Mixed Ip Operations 1.82ms 1.81ms -0.6% ⚪ ✅
Memory Use Web Crawl 1.2 MB 1.2 MB +0.9% ⚪ ✅
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 14.9 MB 13.9 MB -6.7% ⚪ ✅
Scan Throughput 100 2.017s 2.097s +4.0% ⚪ ✅
Scan Throughput 1000 13.845s 13.599s -1.8% ⚪ ✅
Typical Queue Shuffle 4.24µs 4.16µs -1.8% ⚪ ✅
Priority Queue Shuffle 20.62µs 20.73µs +0.5% ⚪ ✅

🎯 Performance Summary

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


🐍 Python Version 3.11.17

@liquidsec
liquidsec merged commit 055319d into dev Oct 19, 2026
26 of 28 checks passed
@liquidsec
liquidsec deleted the git-commit-version branch October 19, 2026 18:37
@liquidsec liquidsec mentioned this pull request Oct 26, 2026
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.

Include git commit hash in scan output when running a non-release version

2 participants