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 direct and transitive.

Nothing references the class yet, so behavior doesn't change. The wiring MR next in the stack uses it.

References

Screenshots or screen recordings

Not applicable: backend only, and behavior doesn't change.

How to set up and validate locally

  1. Run the spec:
    bundle exec rspec ee/spec/lib/security/scan_result_policies/dependency_filter_spec.rb
  2. 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.

  1. !264451 (merged): schemas, config plumbing, and the feature flag. Merged.
  2. This MR: !267117 (merged) adds DependencyFilter, with nothing referencing it yet. It targets master.
  3. !267118 (merged) wires the filter into evaluation, adds the Security::Finding scope, 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

Merge request reports

Loading
Loading