fix(fs): check postAnalyzers for StaticPaths#8543
Merged
knqyf263 merged 3 commits intoaquasecurity:mainfrom Mar 13, 2025
Merged
fix(fs): check postAnalyzers for StaticPaths#8543knqyf263 merged 3 commits intoaquasecurity:mainfrom
knqyf263 merged 3 commits intoaquasecurity:mainfrom
Conversation
- merge `analyzers` + `postAnalyzers` - check this map in StaticPaths function (to check in staticPath mode)
- create AnalyzerType interface and use it in analyzer and PostAnalyzer - add toAnalyzerType function to convert []analyzer and []PostAnalyzer to []AnalyzerType
DmitriyLewen
commented
Mar 13, 2025
Comment on lines
+567
to
+573
| func toAnalyzerType[T AnalyzerType](aa []T) []AnalyzerType { | ||
| var at []AnalyzerType | ||
| for _, a := range aa { | ||
| at = append(at, a) | ||
| } | ||
| return at | ||
| } |
Contributor
Author
There was a problem hiding this comment.
tell me - if you have better way.
- remove AnalyzerType interface - StaticPaths returns error if one postAnalyzer is enabled
DmitriyLewen
commented
Mar 13, 2025
Comment on lines
+559
to
+566
| // PostAnalyzers don't implement StaticPathAnalyzer. | ||
| // So if at least one postAnalyzer is enabled - we should not use StaticPath. | ||
| if allPostAnalyzersDisabled := lo.EveryBy(ag.postAnalyzers, func(a PostAnalyzer) bool { | ||
| return slices.Contains(disabled, a.Type()) | ||
| }); !allPostAnalyzersDisabled { | ||
| return nil, false | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
postAnalyzers don't implement StaticPaths now.
Also it looks like will be hard to implement StaticPaths for them.
So looks like we can just check that PostAnalyzers are enabled.
0intro
referenced
this pull request
in DataDog/trivy
Mar 20, 2025
0intro
referenced
this pull request
in DataDog/trivy
Mar 21, 2025
0intro
referenced
this pull request
in DataDog/trivy
Mar 24, 2025
0intro
referenced
this pull request
in DataDog/trivy
Mar 24, 2025
paulcacheux
referenced
this pull request
in DataDog/trivy
Mar 25, 2025
This was referenced May 23, 2025
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.
Description
To enable
StaticPathsmode - all enabled analyzers must implement theStaticPathAnalyzerinterface.For this we need to check
analyzers. And alsopostAnalyzers(changes in this PR)Otherwise there may be cases when only postAnalyzser is enabled => we enable
StaticPathsmode and skip files.example:
Before:
After:
Related PRs
Checklist