Skip to content

Preserve baseline filters when forcing latest plugins - #1007

Open
josaum wants to merge 1 commit into
Yelp:masterfrom
josaum:fix/force-use-all-plugins-baseline-filters
Open

josaum wants to merge 1 commit into
Yelp:masterfrom
josaum:fix/force-use-all-plugins-baseline-filters

Conversation

@josaum

@josaum josaum commented Oct 25, 2026

Copy link
Copy Markdown

Fixes #502.

Root cause

--force-use-all-plugins is documented to "always use the latest plugins", but its implementation also resets filters loaded from the baseline. In particular, the is_baseline_file exclusion is lost, so the baseline file itself gets scanned. Every run then rewrites the baseline with new/changed findings for the baseline file, and duplicate findings accumulate — exactly the "changes the baseline file every run" behavior in the issue.

Without the flag, the same two scans are stable and the baseline file is excluded (confirmed by reproduction).

Fix

In core/usage/scan.py::parse_args, capture the baseline's filters before re-initializing and restore them afterwards, so only the plugins are replaced by the latest defaults. Filter configuration (including the baseline-file exclusion) is preserved.

Tests

  • tests/core/usage/scan_usage_test.py::test_force_use_all_plugins_preserves_baseline_filters — asserts the baseline-file filter survives the forced re-initialization.
  • tests/main_test.py::TestForceUseAllPlugins::test_forcing_latest_plugins_keeps_baseline_stable — end-to-end: two forced scans of the same project produce identical results and never scan .secrets.baseline.

Both fail on unmodified master and pass with the fix.

Verification

  • Reproduced the bug on current master (5e14193): with the flag, .secrets.baseline is scanned and results differ between runs (duplicate findings accumulate); without it, results are stable. With the fix, forced runs are stable, the baseline file is excluded, and all 27 latest plugins are used.
  • Full suite python -m pytest tests -q — 1025 passed, 11 failed, 6 xfailed; the 11 failures are exactly the same pre-existing, verification/network-related set as on unmodified master in this sandbox (including aws_key_test.py, base_test.py, secrets_collection_test.py), so unrelated to this change.

--force-use-all-plugins re-initializes settings to the latest defaults,
which also reset the filters loaded from the baseline. In particular, the
baseline-file exclusion was lost, so the baseline file itself was scanned
and its results changed on every run.

Capture the baseline filters before re-initializing and restore them
afterwards, so only the plugins are replaced, matching the flag's intent.

Adds a unit test for filter preservation and an end-to-end test that two
forced scans produce identical results and do not scan the baseline file.

Fixes Yelp#502
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.

--force-use-all-plugins flag bug

1 participant