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

add oci bundle spec #3622

Merged
merged 8 commits into from Apr 5, 2024
Merged

Conversation

bdehamer
Copy link
Contributor

@bdehamer bdehamer commented Mar 22, 2024

Closes: #3577

Summary

Adds a new spec doc which describes the scheme for publishing/retrieving Sigstore bundles to/from an OCI registry.

Rendered version

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.41%. Comparing base (2ef6022) to head (8892db3).
Report is 60 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3622      +/-   ##
==========================================
+ Coverage   40.10%   40.41%   +0.31%     
==========================================
  Files         155      155              
  Lines       10044    10087      +43     
==========================================
+ Hits         4028     4077      +49     
+ Misses       5530     5517      -13     
- Partials      486      493       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Brian DeHamer <bdehamer@github.com>
cpanato
cpanato previously approved these changes Mar 23, 2024
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

great work here!

lgtm

Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for contributing this!

specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
specs/BUNDLE_SPEC.md Show resolved Hide resolved
bdehamer and others added 3 commits March 25, 2024 17:04
Co-authored-by: Hayden B <hblauzvern@google.com>
Signed-off-by: Brian DeHamer <bdehamer@github.com>
Co-authored-by: Hayden B <hblauzvern@google.com>
Signed-off-by: Brian DeHamer <bdehamer@github.com>
Co-authored-by: Hayden B <hblauzvern@google.com>
Signed-off-by: Brian DeHamer <bdehamer@github.com>
DSSE-wrapped in-toto statement, the statement's predicate can be reflected
here.

```json
Copy link
Contributor

Choose a reason for hiding this comment

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

Just jotting this down here. Wondering if it would be useful to have a an example out there demonstrating a fully compliant spec?

Copy link
Contributor Author

@bdehamer bdehamer Mar 28, 2024

Choose a reason for hiding this comment

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

I don't know that I want to reference this in the spec, but I do have an example at index.docker.io/bdehamer/hello:latest.

You can poke at this with the oras CLI. Look-up an referring artifacts:

oras discover index.docker.io/bdehamer/hello:latest
Discovered 1 artifact referencing latest
Digest: sha256:01b2325c7cae9939e4484061c37d36e0b95fb3f5e66f80ff924582ba5939e831

Artifact Type                                   Digest
application/vnd.dev.sigstore.bundle.v3.0+json   sha256:30bb112189b0070d8c440fb0c9ef13d4ff25014ccc64d90e5839f90b99c81779

Fetch the bundle manifest:

oras manifest fetch index.docker.io/bdehamer/hello@sha256:30bb112189b0070d8c440fb0c9ef13d4ff25014ccc64d90e5839f90b99c81779
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "artifactType": "application/vnd.dev.sigstore.bundle.v3.0+json",
  "config": {
    "mediaType": "application/vnd.oci.empty.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2,
    "data": "e30="
  },
  "layers": [
    {
      "mediaType": "application/vnd.oci.image.layer.v1.tar",
      "digest": "sha256:0e6245a3f020384b3b10aa2f4fe838ce5e87a71038e710938875cc22d6adb917",
      "size": 10097,
      "annotations": {
        "org.opencontainers.image.title": "bundle.json"
      }
    }
  ],
  "subject": {
    "mediaType": "application/vnd.oci.image.index.v1+json",
    "digest": "sha256:01b2325c7cae9939e4484061c37d36e0b95fb3f5e66f80ff924582ba5939e831",
    "size": 855
  },
  "annotations": {
    "dev.sigstore.bundle.predicateType": "https://slsa.dev/provenance/v1",
    "dev.sigstore.cosign.bundle.content": "dsse-envelope",
    "org.opencontainers.image.created": "2024-03-28T19:44:17Z"
  }
}

Fetch the bundle:

oras blob fetch index.docker.io/bdehamer/hello@sha256:0e6245a3f020384b3b10aa2f4fe838ce5e87a71038e710938875cc22d6adb917 --output -
{"mediaType":"application/vnd.dev.sigstore.bundle.v3.0+json"...}

Copy link
Contributor

@sudo-bmitch sudo-bmitch left a comment

Choose a reason for hiding this comment

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

Love seeing the progress from sigstore on this! Some general feedback from the OCI perspective on this.

specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
Comment on lines 237 to 238
To help disambiguate attestations, clients may add annotations to the items
in the `manifests` list which indicate what is contained within each bundle:
Copy link
Contributor

Choose a reason for hiding this comment

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

Other fields I'd recommend including are the creation/signing date, and the identity of the signer. This is useful for quickly finding the most recently signed content from a trusted identity. OCI already has an annotation for the creation date that I'd recommend reusing: org.opencontainers.image.created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sudo-bmitch I like the idea of an annotation to identify the signer. Is there an pre-defined annotation key you'd recommend for this or should we define our own?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not aware of anything predefined, so making your own under the sigstore namespace makes sense to me.

Copy link
Contributor Author

@bdehamer bdehamer Mar 26, 2024

Choose a reason for hiding this comment

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

Update the list of recommended annotations to include:

  • org.opencontainers.image.created

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, would stick to OCI annotations - just makes it more portable. If you expect images and their signatures to move around, then a arbitrary registry implementation doesn't need to know about dev.sigstore.* namespace.

Signed-off-by: Brian DeHamer <bdehamer@github.com>
Signed-off-by: Brian DeHamer <bdehamer@github.com>
Signed-off-by: Brian DeHamer <bdehamer@github.com>
"annotations": {
"dev.sigstore.bundle.content": "dsse-envelope",
"dev.sigstore.bundle.predicateType": "https://slsa.dev/provenance/v1",
"dev.sigstore.bundle.signer": "cosign/v2.2.3 (darwin; arm64)",
Copy link
Contributor

Choose a reason for hiding this comment

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

For the signer details, the concept I was thinking of would include details used by certificate-identity, certificate-oidc-issuer, etc, so that a cosign verify command could quickly find the matching signature. That could end up being more than one annotation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd worry that would get used to build a verification policy rather than that policy be provided from the caller. I also don't want the annotations to become a duplicate of what's in the envelope/certificate.

Copy link
Contributor

Choose a reason for hiding this comment

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

There may be multiple signatures uploaded for a given digest (hundreds if someone has reproducible builds or runs something daily). Ideally, each of those wouldn't need to be pulled separately to find the one matching the verification policy the user is asking for. This would be an API efficiency, and security would still be provided by validating the envelope/certificate itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we have multiple attestations for the same digest (some recurring, reproducible build) it's likely that the predicate, cert identity, OIDC issuer will be the same for all of them -- surfacing that info as an annotation probably isn't gonna be that useful.

I was chatting w/ @codysoyland who is working on bundle support in the policy-controller and his primary requirement was that the predicate-type be available (as this is a required part of the policy definition).

At this point, I'm inclined to trim the specified annotation list to just the content, predicateType and the created values. Leaving open the option to add more annotations in the future as specific use cases arise.

"annotations": {
"dev.sigstore.bundle.content": "dsse-envelope",
"dev.sigstore.bundle.predicateType": "https://slsa.dev/provenance/v1",
"dev.sigstore.bundle.signer": "cosign/v2.2.3 (darwin; arm64)",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd worry that would get used to build a verification policy rather than that policy be provided from the caller. I also don't want the annotations to become a duplicate of what's in the envelope/certificate.

specs/BUNDLE_SPEC.md Outdated Show resolved Hide resolved
Signed-off-by: Brian DeHamer <bdehamer@github.com>
@haydentherapper
Copy link
Contributor

@bdehamer, great work on this, LGTM! I'll leave it open til mid next week in case there's any other comments.

@haydentherapper
Copy link
Contributor

Merging now, thanks all for the discussion, and thanks @bdehamer for authoring the spec!

@haydentherapper haydentherapper merged commit 3c8170a into sigstore:main Apr 5, 2024
29 checks passed
@github-actions github-actions bot added this to the v2.3.0 milestone Apr 5, 2024
@bdehamer bdehamer deleted the bdehamer/bundle-spec branch April 5, 2024 17:42
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.

Sigstore Bundle as OCI Artifact
7 participants