Do not silently drop findings listed in a baseline inside the scanned tree - #94
Open
arpitjain099 wants to merge 1 commit into
Open
Conversation
… tree The baseline is read from .pyspector_baseline.json inside the directory being scanned, so when that directory came from somewhere else the file that suppresses findings came from there too. A scan of a tree carrying a baseline can therefore report clean while dropping results, and nothing says so: the Baseline-ignored counter only prints under --stats. Print the suppressed count unconditionally when it is non-zero, naming the file, and add --no-baseline for callers that never want a baseline picked up from the tree at all (CI scanning untrusted branches). Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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.
Opening this as a public PR per your note on GHSA-7875-p889-5wvx.
The baseline is read from
.pyspector_baseline.jsoninside the directory being scanned, so when that directory came from somewhere else, the file that decides which findings to drop came from there too. The part that bothered me is not the trust question, which you have already called out of scope, but that it happens with no output at all:Baseline-ignoredis only printed under--stats, so a scan can report clean while silently dropping results.Two changes:
--no-baselinefor callers that never want one picked up from the tree, which is mainly CI scanning branches it did not writeBehaviour is otherwise unchanged, and a baseline you put there yourself still works exactly as before. You just get told.
Checked in a
python:3.12-slimcontainer, built from source, on a file containingos.systemandeval:Happy to change the wording or the colour of the notice if you would rather it read differently.
I used AI assistance while working on this. The three runs above are mine, built from source at 7492032 since the PyPI wheel needs pkg-config and libssl-dev to build.