Loading
Add dependency filter for approval policy findings
What does this MR do and why?
Adds Security::ScanResultPolicies::DependencyFilter, the building block for filtering dependency scanning findings by dependency change. It's part of the stack for #635482.
- The filter matches each finding's lockfile path, package name, and version against the SBOM components of the target pipeline (
dependency_change) and against the dependency graph of the source pipeline SBOM (dependency_type). - A finding UUID matches when any of its rows matches.
- Without a target SBOM, every finding counts as
introduced. - A finding with an unknown dependency type matches both
directandtransitive.
Nothing references the class yet, so behavior doesn't change. The wiring MR next in the stack uses it.
References
- Related to #635482
- Feature flag rollout: https://gitlab.com/gitlab-org/gitlab/-/work_items/635635
- Follow-ups:
- Rules with only previously existing states: https://gitlab.com/gitlab-org/gitlab/-/work_items/635632
- Rule builder support: #635633
- Container scanning: #635634
Screenshots or screen recordings
Not applicable: backend only, and behavior doesn't change.
How to set up and validate locally
- Run the spec:
bundle exec rspec ee/spec/lib/security/scan_result_policies/dependency_filter_spec.rb - There is no UI or API change to check. Only the spec references the new class.
MR stack
This MR is part of a stack that replaces one 760-line MR. Merge the MRs in order.
- !264451 (merged): schemas, config plumbing, and the feature flag. Merged.
- This MR: !267117 (merged) adds
DependencyFilter, with nothing referencing it yet. It targetsmaster. - !267118 (merged) wires the filter into evaluation, adds the
Security::Findingscope, and adds the docs. It targets this MR's branch.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Alan (Maciej) Paruszewski