Repository navigation
Conversation
--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
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.
Fixes #502.
Root cause
--force-use-all-pluginsis documented to "always use the latest plugins", but its implementation also resets filters loaded from the baseline. In particular, theis_baseline_fileexclusion 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
masterand pass with the fix.Verification
master(5e14193): with the flag,.secrets.baselineis 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.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 unmodifiedmasterin this sandbox (includingaws_key_test.py,base_test.py,secrets_collection_test.py), so unrelated to this change.