Skip to content

Draft: Add search for dependency locations

Zamir Martins requested to merge add_search_for_locations into master

What does this MR do and why?

Add search for dependency locations

EE: true Changelog: changed

Related issue: #409068 (closed)

Screenshots or screen recordings

dependency_locations

Query plan

Link to query plan for one of the worst cases.

SELECT "sbom_occurrences".*
FROM "sbom_occurrences"
WHERE "sbom_occurrences"."source_id" IN (
  SELECT "sbom_sources"."id"
  FROM "sbom_sources"
  WHERE (source->'input_file'->>'path' ILIKE '%yarn%')
)
AND "sbom_occurrences"."component_id" = 216
AND "sbom_occurrences"."project_id" IN (
  SELECT "projects"."id"
  FROM "projects"
  WHERE "projects"."namespace_id" IN (
    SELECT namespaces.traversal_ids[array_length(namespaces.traversal_ids, 1)] AS id
    FROM "namespaces"
    WHERE "namespaces"."type" = 'Group' AND (traversal_ids @> ('{6543}'))
  )
)
LIMIT 50;

How to set up and validate locally

  1. Fetch the content of both branches: add_search_for_project_component .
  2. Turn on the feature flag to make Dependency list appear in groups:
echo "Feature.enable(:group_level_dependencies)" | rails c
  1. Create two projects under a group with the following content:
  • .gitlab-ci.yml:
include:
  - template: Security/Dependency-Scanning.gitlab-ci.yml
  1. Run a pipeline for the default branch to both projects
  2. Go group related to the projects created above and click on the menu option Secure -> Dependency list

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Zamir Martins

Merge request reports