Skip to content

Expose licenses in dependencies API

Dominic Couture requested to merge dcouture-license-dependencies-api into master

What does this MR do and why?

It exposes licenses information in the dependencies API to be equivalent to the dependencies controller (/:group/:project/-/dependencies.json).

Related to gitlab-com/gl-security/engineering-and-research/gib#40

Screenshots or screen recordings

The license was already showing on http://gdk.test:3000/gitlab-org/gitlab-shell/-/dependencies

image

But now the REST API also contains the data http://gdk.test:3000/api/v4/projects/2/dependencies

image

How to set up and validate locally

  1. Add this CI config to a project (I used gitlab-org/gitlab-shell in the GDK and replaced the existing config for this test)

    include:
      - template: Security/Dependency-Scanning.gitlab-ci.yml
      - template: Security/License-Scanning.gitlab-ci.yml
  2. Wait for the pipeline to complete

  3. Visit http://gdk.test:3000/api/v4/projects/2/dependencies and observe the licenses for the packages where the info is available

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 Dominic Couture

Merge request reports