gowitness: ephemeral per-batch database#3241
Merged
Merged
Conversation
Each batch writes to a throwaway SQLite database in the scan temp dir that is deleted once its events are emitted, instead of accumulating in one shared database for the whole scan. Keeps memory flat on large scans (the shared network_logs table grew unbounded and was re-read in full every batch, causing OOM). Reads now tolerate a missing schema, which happens when chrome fails to launch and gowitness exits before creating its tables -- previously that raised "no such table: results" on every affected batch. Removes the persistent database, the report-server gallery hint, and the per-scan binary copy.
Contributor
📊 Performance Benchmark Report
📈 Detailed Results (All Benchmarks)
🎯 Performance Summary✅ No significant performance changes detected (all changes <10%) 🐍 Python Version 3.11.15 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3241 +/- ##
=====================================
+ Coverage 90% 90% +1%
=====================================
Files 453 453
Lines 46304 46258 -46
=====================================
- Hits 41411 41371 -40
+ Misses 4893 4887 -6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ausmaster
approved these changes
Jun 25, 2026
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
On large scans the
gowitnessmodule OOMs, and floods the log withno such table: results. Two root causes:Unbounded memory. The module used one shared
gowitness.sqlite3for theentire scan and, every batch, re-ran
SELECT *over the whole (ever-growing)results/network_logs/technologiestables, deduping in per-scanPython sets.
network_logsexplodes on big scans (a row per sub-request perpage), so memory and per-batch work grew with cumulative scan size. Only
happens with gowitness enabled.
no such table: resultsflood. The readers ranSELECT *unguarded.When chrome fails to launch, gowitness exits before creating its schema, so
the query raised
OperationalError: no such table: results, surfaced asError in gowitness.handle_batch(...)for every affected batch.Fix
scan.temp_dir, deleted in afinallyonce events are emitted. Memory stays flat regardless of scan size.gowitness exited before writing its schema -- now logs a single warning
(
Gowitness produced no results for N URLs; chrome may have failed to launch)and the scan continues, instead of flooding the log per row.
gowitness report servergallery hint, and theper-scan binary copy -- intentional; the gallery depended on the persistent DB.
Screenshots still persist on disk and as
WEBSCREENSHOTevents.