Create Attestations List API

Why are we doing this work

In order to support the SLSA Verification Workflow an API will need to be created to allow attestations to be listed. The scope of this issue is to build out the implementation for this API.

Requirements

  • Authentication is required. Discussion here.
  • Endpoint /project/:id/attestations/:subject_digest, :subject_digest as sha256:HEX_DIGEST
  • Should return an array of attestations
  • Should support pagination

Relevant links

Non-functional requirements

Implementation plan

  1. Mount a new api endpoint in lib/api/api.rb
  2. Create a new class that inherits from ::API::Base in lib/api/supply_chain/attestations.rb. Ensure return type is an array of attestations.
  3. Implement authentication. Check if the user has read access to the project. Create a custom permission in app/policies/project_policy.rb for :read_attestation so that permission can be adjusted independent of other permissions if necessary. Discussion here.
  4. Implement pagination as described in the Pagination guidelines.

Verification steps

Edited by Sam Roque-Worcel