Skip to content

log: surface real failures in error.log#3127

Merged
liquidsec merged 3 commits into
devfrom
error-log-promotions
May 30, 2026
Merged

log: surface real failures in error.log#3127
liquidsec merged 3 commits into
devfrom
error-log-promotions

Conversation

@liquidsec

Copy link
Copy Markdown
Collaborator

Follow-up to #3123 (TRACE routing fix). Now that error.log is no longer drowning in TRACE noise, this audits what should be there and currently isn't — so that on a clean scan error.log is empty, and on a broken scan it's the one place you go.

Promoted from warning to error (currently surface as warnings in scan.log only)

Site What it means
BaseModule.set_error_state A module gave up after hitting the abort threshold. Sample scan log: 6 modules in this state (subdomaincenter, skymem, leakix×2, hackertarget×2). Canonical 'module broken' signal.
DNSHelper 'DNS queries are failing, please check your internet connection' Network is broken. Sample log: 5×.
DepsInstaller 'Failed to install pip packages / OS packages / shell deps / Ansible tasks / sudo-no-TTY' Module can't run; user needs to know.
Scanner 'Setup hard-failed for {module}: {msg}' Scan-fatal setup failure.
Scanner 'Failed to load module {module_class}' Module didn't even load.

Promoted from hugewarning to critical

Site What it means
Scanner.abort 'Aborting scan' The scan died. self.critical(..., trace=False) still renders big-text in the terminal but also lands in error.log.

Added missing logging

Site What it means
cli.main KeyboardInterrupt Ctrl-C now writes to error.log via log.error, not just stderr.
cli.main uncaught Exception Any non-BBOTError/KeyboardInterrupt exception was falling through to Python's default handler — stderr only, never in error.log. Now caught with log.error + log.trace + non-zero exit.

Demoted from warning to verbose (currently noise)

Site Why
wayback.query 'Error connecting to archive.org' / 'Error JSON-decoding archive.org response' 2,436 of the 2,600 warnings in the sample log. Archive.org's CDX endpoint is chronically slow; the module retries cleanly.

Effect on the sample scan log

Before: 2,600 WARNINGs in scan.log, 0 ERRORs anywhere, 145K lines of TRACE noise in error.log.
After (estimated): ~160 WARNINGs, ~22 ERRORs in error.log surfacing actual broken modules + 'Aborting scan' + DNS failures + dep failures, ~0 lines on a clean scan.

Promote 'unusual condition' messages from warning to error so error.log
becomes useful as the first place to look when something goes wrong:

- BaseModule.set_error_state: warning -> error (and critical when critical=True)
  -- the canonical 'this module gave up' signal.
- DNS connectivity-failed message: warning -> error.
- Dependency-install failures (pip / OS pkg / shell / Ansible / sudo-no-TTY):
  warning -> error.
- Module setup hard-fail and module load failure in Scanner: warning -> error.
- Scanner 'Aborting scan': hugewarning -> critical (still big-text in terminal
  AND now lands in error.log).
- CLI: catch KeyboardInterrupt and any unhandled top-level Exception, log them
  via log.error + log.trace so the failure mode is recorded in error.log
  instead of dying silently to stderr.

Demote noisy-but-handled wayback per-query failures (archive.org is chronically
slow; the module retries cleanly) from warning to verbose. These were 2,400+
of the 2,600 warnings in a sample scan log.
@github-actions

github-actions Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🚀 Performance Benchmark Report

⚠️ No current benchmark data available

This might be because:

  • Benchmarks failed to run
  • No benchmark tests found
  • Dependencies missing

scanner.setup-hard-failed and module set_error_state both now log at ERROR
per this PR. update the cli test assertions accordingly.
@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.51852% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 90%. Comparing base (feacaba) to head (ebc20ef).
⚠️ Report is 13 commits behind head on dev.

Files with missing lines Patch % Lines
bbot/cli.py 12% 8 Missing ⚠️
bbot/core/helpers/depsinstaller/installer.py 0% 8 Missing ⚠️
bbot/scanner/scanner.py 25% 3 Missing ⚠️
bbot/modules/wayback.py 0% 2 Missing ⚠️
bbot/core/helpers/dns/dns.py 0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             dev   #3127   +/-   ##
=====================================
- Coverage     90%     90%   -0%     
=====================================
  Files        441     441           
  Lines      38743   38751    +8     
=====================================
- Hits       34663   34662    -1     
- Misses      4080    4089    +9     

☔ View full report in Codecov by Sentry.
📢 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.

@liquidsec liquidsec assigned liquidsec and ausmaster and unassigned ausmaster May 25, 2026
@liquidsec liquidsec requested a review from ausmaster May 25, 2026 15:17
- kill_module: pass log_level="info" to set_error_state
- KeyboardInterrupt in cli: warning instead of error
- "Aborting scan": revert to hugewarning (triggered by Ctrl-C)

set_error_state gains a log_level kwarg so callers can pick the severity.
Genuine failures (setup hard-fail, API threshold, dep install, DNS dead)
still log at ERROR.

@ausmaster ausmaster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In conjunction with #3123, is good. Ensure both are merged in.

@liquidsec liquidsec merged commit 1911fcb into dev May 30, 2026
19 of 20 checks passed
@liquidsec liquidsec mentioned this pull request May 30, 2026
@liquidsec liquidsec mentioned this pull request Jun 9, 2026
@ausmaster ausmaster deleted the error-log-promotions branch June 11, 2026 01:27
@ausmaster ausmaster added this to the BBOT 3.0 - blazed_elijah milestone Jun 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.

2 participants