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

Implement Sigstore signing and verification of models #276

Merged
merged 5 commits into from
Aug 5, 2024

Conversation

mihaimaruseac
Copy link
Collaborator

Summary

Supports all payloads, although in the future we will deprecate most of them, as these are created to migrate existing serialize_v0/serialize_v1 implementation and to experiment with UX and benchmarking.

Each commit can be reviewed individually. In order these are:

  • Add a from_str method to manifest.Shard: Adds a method to Shard class to ease parsing a signature back to manifest. Adds tests.
  • Ensure all in-toto statements have names for subjects: Names are optional in the spec, but required by sigstore-python. So, we use a default name of "." when another cannot be provided.
  • Add SigstoreSignature for storing Sigstore signatures: as it says on the tin, just one simple class to allow saving and loading of Sigstore Bundles.
  • Sign models with Sigstore, generate Sigstore bundles: sign any model serialization
  • Verify sigstore bundles: support verification of any sigstore bundle generated by the library.

TODO: add tests for signing and verification, in a subsequent PR.

Release Note

NONE

Documentation

NONE

@mihaimaruseac mihaimaruseac requested review from a team as code owners August 5, 2024 20:47
laurentsimon
laurentsimon previously approved these changes Aug 5, 2024
The `ShardedFileManifestItem` objects (items in `ShardLevelManifest`)
are recorded as a single string in the in-toto payloads used for
signing. The canonicalization to string is done by appending the file
(relative) path, the start offset and the end offset, separated by `:`.

When validating a signature and rebuilding a manifest, we need to parse
a string back to a shard. Rather than replicating this in all places, we
create a member function for the conversion.

Also adds the relevant tests.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Although names in in-toto are optional, for sigstore-python they are
mandatory. So, we set the name to "." when we don't have other option.

Updated goldens to reflect the change.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Supports both signing models serialized to digests (a la
`serialize_v0`/`serialize_v1`) and models serialized to manifests.

Suppoorts both signing digests directly and signing in-toto manifest.

There is a need to convert from in-toto's in-toto types to the ones
expected by sigstore-python, but this additional step will be removed in
the future.

Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
@mihaimaruseac mihaimaruseac merged commit e8db349 into sigstore:main Aug 5, 2024
20 checks passed
@mihaimaruseac mihaimaruseac deleted the sigstore-sign branch August 5, 2024 21:52
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.

2 participants