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

docs(sbom): improve SBOM docs by adding a description for scanning SBOM attestation #2690

Merged
merged 4 commits into from
Aug 10, 2022

Conversation

otms61
Copy link
Collaborator

@otms61 otms61 commented Aug 9, 2022

Description

I've improved SBOM docs by adding a description for scanning SBOM attestation.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@otms61 otms61 requested a review from knqyf263 as a code owner August 9, 2022 15:50
In the following example, Cosign can get an attestation and trivy scan it.

```bash
$ cosign verify-attestation --key /path/to/cosign.pub --type cyclonedx <IMAGE> > sbom.cdx.intoto.jsonl
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it includes several attestations, Trivy fails to scan, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The --type cyclonedx option of Cosign will take only cyclonedx attestation if the image has multiple attestations.
Depending on the number of cyclonedx attestations, the behavior will be as follows.

  • If there is no cycnlonedx attestation, the cosign command will fail.
  • If there is one cycnlonedx attestation, Trivy will successfully scan. This situation is assumed in the text of the description.
  • (rare case) If there is more than one cycnlonedx attestation, it will also successfully scan because json.NewReader parses only the first line if there are multiple lines in input data(ref). This is unintended behavior but it is not bad because they may be the same content.

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've added a note that before trying the example, you create CycloneDX-type attestation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If there is more than one cycnlonedx attestation, it will also successfully scan because json.NewReader parses only the first line if there are multiple lines in input data(ref).

I didn't know that. Cool. Thanks for your explanation.

@otms61
Copy link
Collaborator Author

otms61 commented Aug 10, 2022

Since CycloneDX is more advanced supported than SPDX, I've used CycloneDX in the example.
And I've added examples of commands so viewers don't have to look at other sites.

@knqyf263 knqyf263 merged commit 6879413 into aquasecurity:main Aug 10, 2022
@otms61 otms61 deleted the sbom_attest_docs branch August 10, 2022 23:00
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.

None yet

2 participants