Skip to content

Fix -lp scanning arbitrary directories when -p is also specified#3192

Merged
liquidsec merged 1 commit into
devfrom
preset-path-listable
Jun 16, 2026
Merged

Fix -lp scanning arbitrary directories when -p is also specified#3192
liquidsec merged 1 commit into
devfrom
preset-path-listable

Conversation

@liquidsec

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes When listing presets (-lp), BBOT tries to parse every YAML file in $HOME #3189
  • When -p loads a preset from an arbitrary path (e.g. ~/my_preset.yml), PresetPath.find() adds the parent directory to the search path list for include resolution. all_presets (used by -lp) was iterating that same list with rglob, causing it to try parsing every .yml file under the parent directory (e.g. all of $HOME).
  • Adds a listable flag to add_path() so only the two canonical preset directories (built-in bbot/presets/ and ~/.bbot/presets/) are enumerated by -lp. Paths added by find() remain searchable for include resolution but are excluded from enumeration.

PresetPath.find() adds the parent directory of any resolved preset to
the search path list, which is correct for include resolution. But
all_presets (used by -lp) was iterating the same list, causing it to
rglob every .yml file under those incidentally-added directories. On a
typical Linux system this means hundreds of Ansible/CI yaml files in
$HOME produce warning spam.

Add a listable flag to add_path() so only the two canonical preset
directories (built-in and ~/.bbot/presets) are enumerated by -lp.
@liquidsec liquidsec requested a review from ausmaster June 16, 2026 02:18
@liquidsec

Copy link
Copy Markdown
Collaborator Author

@ausmaster can you validate

@github-actions

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 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.95918% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90%. Comparing base (c07e3e7) to head (f99261a).

Files with missing lines Patch % Lines
bbot/scanner/preset/path.py 91% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             dev   #3192   +/-   ##
=====================================
- Coverage     90%     90%   -0%     
=====================================
  Files        449     449           
  Lines      44389   44435   +46     
=====================================
+ Hits       39716   39757   +41     
- Misses      4673    4678    +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.

@liquidsec liquidsec merged commit d4ea12f into dev Jun 16, 2026
16 of 18 checks passed
@liquidsec liquidsec deleted the preset-path-listable branch June 16, 2026 03:15
@ausmaster ausmaster added this to the BBOT 3.0 - blazed_elijah milestone Jun 16, 2026
@liquidsec liquidsec mentioned this pull request Jul 7, 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