Fix blacklisted_paths can not work on scan image feature #45
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.
Hi, I try to use blacklisted_paths to ignore some dir when using image scan, but it not work.
In IsSkippableDir function, use path var to compare with skippablePathIndicator var that read from blacklisted_paths, I try to print path to I get some path problem.
For example:
If I want to ignore /bin path, code will compare both two string by use HasPrefix
But in image scan feature, path output is like this:
/tmp/Deepfence/SecretScanning/df_demoimage4/ExtractedFiles/<layer_id>/bin
This is reason that I this blacklisted_paths not work
So I try use TrimPrefix to let path like this:
Original
/tmp/Deepfence/SecretScanning/df_demoimage4/ExtractedFiles/<layer_id>/bin
After TrimPrefix
/bin
It will work on IsSkippableDir function, and can successful ignore blacklisted_paths by use image scan