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

Introduce attestation metadata #3342

Merged
merged 4 commits into from
Dec 7, 2022
Merged

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Nov 30, 2022

This will be useful to help with default values for docker/buildx#1412.

With this PR, buildx can attach the option --opt attest:provenance=mode=min,inline-only=true. This inline-only option is propagated through attestation metadata to the exporter, where it can be filtered out for the local/tar exporters, while being included for the image/oci/docker exporters. We could achieve similar functionality if we attempted to explicitly modify the exporter properties in buildx, but this would be overly complex logic to put into the client.

Additionally, I've added a reason field to the metadata, which can be optionally added to the metadata on attestation creation indicating the purpose of the attestation - in the future, this could be used by the exporter to filter out specific attestations for exporters (will be useful when we support multiple exporters, if different attestation output is desired). We could also (maybe) use the metadata in the SBOM scanner component to detect if the scanner has already run instead of relying on checking the predicate types.

We can now attach a reason for why each attestation was generated, which
will in future allow us to include/exclude specific attestation types
from exporters if desired.

Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
@@ -68,6 +66,11 @@ func ProvenanceProcessor(attrs map[string]string) llbsolver.Processor {
}
}

var inlineOnly bool
if v, err := strconv.ParseBool(attrs["inline-only"]); v && err == nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not a fan of inline-only as the name of the option in hindsight. 1. It has a different meaning to inline for the exporters, and 2. it's not clear what property makes image/oci inline but not local/tar.

Other ideas welcome here 🎉

Copy link
Member

Choose a reason for hiding this comment

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

I'm not a fan of inline-only

attach / embed maybe?

@jedevc jedevc added this to the v0.11.0 milestone Nov 30, 2022
Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

In order to support the buildx case this should also change the mode defaults for provenance and remove mode=disabled.

@jedevc
Copy link
Member Author

jedevc commented Dec 6, 2022

mode=disabled/none is already removed, and have now set the default to max.

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc merged commit d32cb4a into moby:master Dec 7, 2022
@jedevc jedevc deleted the attestation-metadata branch December 7, 2022 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants