Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved attestation inspect #1498

Merged
merged 5 commits into from
Jan 9, 2023
Merged

Conversation

jedevc
Copy link
Collaborator

@jedevc jedevc commented Jan 9, 2023

⬆️ Follow up to #1444

This includes 3 main changes:

  • Break after first found SPDX document (prioritizes the first attestations to take advantage of exporter: ensure spdx order prioritizes primary sbom moby/buildkit#3479)
  • Re-work stub structs to have interface{} types instead of json.RawMessage; this allows them to be accessed using go template notation, e.g. --format "{{ range .SBOM.SPDX.packages }}{{ println .name .versionInfo }}{{ end }}".
    • We strip away the Predicate field to directly access the predicate of the attestation. In the future, we should to sanity check the subject of the attestation against the pulled image, as well as the predicate type - this should be the responsibility of the go-imageinspect library.
    • If we want to provide access to the raw attestation contents (including subject, predicate-type, etc) in the future, we likely want to do that through a simple .Attestations field, but it seems an edge use-case for now.
  • Allow access to multiple SPDX documents (created using the BUILDKIT_SBOM_SCAN args). The first SPDX document is added to .SPDX, while all documents are appended to .SPDXs - this can allow tools to search through dependencies used in build tooling.

@jedevc jedevc added this to the v0.10.0 milestone Jan 9, 2023
Comment on lines +294 to 296
type provenanceStub struct {
SLSA interface{} `json:",omitempty"`
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provenance > SLSA? I thought it was SLSA > Provenance to keep common denominator first? Like in the future we can have SLSA > VSA.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to have Type > Format. We have SBOM > SPDX, so I think it makes sense to have Provenance > SLSA.

VSA isn't provenance, so we'd have another "type" for that I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

@crazy-max
Copy link
Member

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Are we going to document on docs repo advanced use cases to retrieve list of packages in an SBOM for example?

as.sbom = &sbomStub{
SPDX: dt,
var spdx struct {
Predicate interface{} `json:"predicate"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit concerned that there isn't any way to extract the actual attestation. But I guess we can add some special case/command for that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants