Reduce permissions required to export an SBOM
SBOMs can be exported from GitLab with this tutorial, but to do so, a token with the api scope is required.
api scope is the highest permission level ("Grants complete read/write access to the API, including all groups and projects") that can be granted, just for one operation (exporting the SBOM). This makes this feature risky to use at scale.
In comparison, GitHub has an API endpoint to export project SBOMs that relies on a readonly permission ("Contents" repository permissions (read)).
Proposal
There are two options there:
- Don't require the
apiscope, but only theread_apiscope. - Create a specific scope with the
read_dependencyandread_vulnerabilityabilities