Skip to content

Validate Before Bake#3148

Merged
liquidsec merged 17 commits into
preset-validationfrom
pr3058-validate-before-bake
Jun 8, 2026
Merged

Validate Before Bake#3148
liquidsec merged 17 commits into
preset-validationfrom
pr3058-validate-before-bake

Conversation

@liquidsec

Copy link
Copy Markdown
Collaborator

No description provided.

ausmaster and others added 6 commits June 4, 2026 17:20
Previously bake() coerced config and called validate() itself, and from_dict
validated the raw dict up front -- so coercion (a 'bake step') effectively ran
before bake(), and the programmatic/bbot.yml entry points were never validated.

Invert it:
- Preset.validate() is now the precondition: coerces custom_config toward its
  declared types AND validates it, sets self._validated, returns self.
- bake() ENFORCES it: raises if the preset isn't validated (it no longer
  coerces or validates itself).
- merge() / mutations reset _validated, so a changed preset must be revalidated.
- Scanner.__init__, the CLI, and from_dict call validate() before baking.

Side effects:
- config is now validated on every entry point (programmatic Preset(config=)/
  Scanner(config=), bbot.yml, presets, CLI), closing the validation-asymmetry gap.
- surfaced a missing internal-module toggle: 'unarchive' was absent from
  BBOTConfig (so 'bbot -c unarchive=false' was rejected); added it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Direct preset.bake() -> preset.validate().bake() (validate() returns self);
  bake() now requires a validated preset.
- test_config: the programmatic path is now strictly validated, so the old
  sentinel keys ('plumbus', module 'test_option') are correctly rejected as
  typos; rewritten to verify config propagation with real keys
  (status_frequency, ipneighbor.num_bits, module_timeout).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
from_dict reads a preset's top-level keys with .get(), so a typo'd or
  unknown top-level key (e.g. `modlues:`) was silently dropped instead of
  surfaced. And per the validate-before-bake contract, validate() should be
  the single comprehensive gate for everything a preset declares.

  - validate.py: add prevalidate_preset(), a thorough top-level KEY check
    that reports every unknown/typo'd key with a closest-match hint. Keys
    only -- it does not coerce or validate config values.
  - preset.py from_dict(): auto-run prevalidate_preset() up front, and stop
    calling validate() itself -- it now returns an explicitly unvalidated
    preset. Coercion + full validation remain the caller's step before
    bake() (Scanner and the CLI already do this).
  - preset.py validate(): also validate the declared scan/output module
    names (reusing _is_valid_module), so an unknown module name fails here
    instead of only at bake().
  - tests: top-level typo -> from_dict raises; config-value typo and unknown
    module name -> validate() raises.

  bake() is unchanged and still trusts an already-validated preset.
- Add 'recursive' to scan name adjectives (how was this missing?)
- Both easter eggs now require exact name match (recursive_thetechromancer,
  golden_gus) instead of endswith
- Skip easter eggs entirely when NO_COLOR is set
@github-actions

github-actions Bot commented Jun 6, 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

@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.97531% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 90%. Comparing base (2bc1f4b) to head (2c3819a).
⚠️ Report is 114 commits behind head on preset-validation.

Files with missing lines Patch % Lines
bbot/scanner/scanner.py 34% 8 Missing ⚠️
bbot/scanner/preset/preset.py 87% 3 Missing ⚠️
bbot/core/config/models.py 90% 1 Missing ⚠️
bbot/scanner/preset/validate.py 89% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           preset-validation   #3148    +/-   ##
==================================================
+ Coverage                 90%     90%    +1%     
==================================================
  Files                    451     447     -4     
  Lines                  39806   40444   +638     
==================================================
+ Hits                   35675   36285   +610     
- Misses                  4131    4159    +28     

☔ 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.

@liquidsec liquidsec merged commit c4e4168 into preset-validation Jun 8, 2026
23 of 25 checks passed
@liquidsec liquidsec deleted the pr3058-validate-before-bake branch June 8, 2026 13:17
@liquidsec liquidsec mentioned this pull request Jun 9, 2026
@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