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

Draft: SBOM refactor for registry images #298

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

natalieparellano
Copy link
Member

@natalieparellano natalieparellano commented Sep 29, 2023

@buildpack-bot
Copy link
Member

Maintainers,

As you review this RFC please queue up issues to be created using the following commands:

/queue-issue <repo> "<title>" [labels]...
/unqueue-issue <uid>

Issues

(none)


## Next builds

During `analyze`, the lifecyle should verify attestations for the previous application image, and download the SBOM data as files in `<layers>/sbom/launch/`
Copy link
Member Author

Choose a reason for hiding this comment

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

If there is an SBOM in the registry for the run image, we could do interesting things, like provide that to buildpacks (somehow, somewhere) so they could know more about what's available. But that should probably be out of scope for now.

- Why should we do this?

Our current approach has a few drawbacks, namely:
* It can make application images quite large
Copy link
Member Author

Choose a reason for hiding this comment

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

Examples here would be nice


The `exporter` will accept a new optional flag `-omit-sbom` that defaults to `false`.
* If `-omit-sbom=false` the exporter will behave as today, and include the SBOM layer containing the `<layers>/sbom/launch/` directory in the application image.
* If `-omit-sbom=true` the exporter will not create the SBOM layer, but `<layers>/sbom/launch/` will remain on the filesystem and be available to the `signer`.
Copy link
Member Author

Choose a reason for hiding this comment

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

If -daemon is true we might log a warning or error


### Example 3 - platform-provided SBOM file

Platforms could inject TOML to describe the run image, e.g.:
Copy link
Member Author

Choose a reason for hiding this comment

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

This could be concatenated to the configuration file output by the exporter

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@RealHarshThakur
Copy link

Couple thoughts:
There's been recent work in Buildkit and Docker to provide SBOM and provenance as part of the image. I think there's a lot that can be potentially re-used or integrated directly.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano changed the title Draft: SBOM refactor Draft: SBOM refactor for registry images Oct 2, 2023
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Copy link
Member

@AidanDelaney AidanDelaney left a comment

Choose a reason for hiding this comment

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

In general, this looks good to me. I have one query as to whether we expect signer to write to a registry, or if it is generating an on-disk signature that exporter will export (I'm assuming the latter from the examples provided).

We should explore secure ways of allowing the platform to inject this data (TODO).
It's worth noting that `cosign` as of v2 prefers keyless signing.

The `signer` can both sign the image and attach attestations to it. By default, we should do both - but we may want to make this configurable.
Copy link
Member

Choose a reason for hiding this comment

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

signer is then a registry operation? This means that both signer and exporter now write to the registry?

## Setup

The lifecycle will ship with a new `signer` binary.
In the past we've talked about making this binary totally separate from the lifecycle,
Copy link
Member Author

@natalieparellano natalieparellano Oct 5, 2023

Choose a reason for hiding this comment

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

From 10/5 Working Group - cosign is nevertheless a significant dependency to take into the lifecycle. If cosign took a configuration file (sigstore/cosign#1288 or similar) maybe we could just set that configuration up according to the mapping defined below. That would take care of the signing part.

For retrieving SBOMs from the previous image, we could:

  • explore making verifying attestations the responsibility of the "preparer" binary, if we ever have one; the preparer could write the predicate data as json for the analyzer to find
  • put this in the analyzer and hope the dependency footprint would be smaller if we're only verifying signatures (not creating them)


The exporter will additionally generate configuration for the `signer` irrespective of the value of `-omit-sbom`.

## Sign
Copy link
Member Author

Choose a reason for hiding this comment

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

From 10/5 Working Group - adding signatures could be a big jump for platforms that just want to get the SBOM out of the application image. We could provide an option to generate unsigned attestations as OCI artifacts in the registry which might ease the migration path for some folks.


TODO

Discuss prior art, both the good and bad.

Choose a reason for hiding this comment

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

Maybe the current cosign implementation in kpack could be referenced here?

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

5 participants