Skip to content

Fix order-dependent SRA

What does this MR do and why?

When multiple SBOMs exist (e.g., root pom.xml and subdirectory metrics/pom.xml), the BelongsToProject() classifier incorrectly treated root directory . as having depth 1 instead of 0. This caused it to tie with subdirectories at depth 1, making results dependent on input order.

Solution

Modified countDirs() to return 0 for root directory ., ensuring it's always sorted as least specific (last) regardless of input order.

Manual testing

See gitlab-org/gitlab#577752 (comment 2834687595)

Related issues

DS: Fix java reachability E2E tests (gitlab-org/gitlab#577752) • Orin Naaman • 18.6 Update sbom comparison job to validate multiple... (gitlab-org/security-products/tests/gson-fork!2 - merged) • Orin Naaman • 18.6

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Orin Naaman

Merge request reports

Loading