Skip to content

API for signatures#57

Merged
runcom merged 2 commits intocontainers:masterfrom
mtrmac:api-for-signatures
May 16, 2016
Merged

API for signatures#57
runcom merged 2 commits intocontainers:masterfrom
mtrmac:api-for-signatures

Conversation

@mtrmac
Copy link
Contributor

@mtrmac mtrmac commented May 16, 2016

This adds methods useful for validating signatures to types.Image, namely the ability to retrieve signatures, and the supposedly signed identity, and renames RawManifest for consistency.

The implementation remains Docker-specific (in particular, not usable for OpenShift), but having the type and API will allow the policy evaluation code to compile, which is on my critical path now.

See comments in the individual commits for details.

mtrmac added 2 commits May 16, 2016 19:25
No change in behavior.

These functions are guaranteed-cached versions of the same method in
types.ImageSource.  Both will be needed for signature policy evaluation,
and the symmetry with ImageSource is nice.

Also replaces the equivalent RawManifest method, preferring to keep
the same naming convention as types.ImageSource.
This will be necessary for signature verification and related policy
evaluation in the future.
// GetManifest is like ImageSource.GetManifest, but the result is cached; it is OK to call this however often you need.
GetManifest() ([]byte, error)
// GetSignatures is like ImageSource.GetSignatures, but the result is cached; it is OK to call this however often you need.
GetSignatures() ([][]byte, error)
Copy link
Member

Choose a reason for hiding this comment

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

nit, but I don't like Get(er) or setter in Go - calling image.Signatures is pretty straightforward and clean WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

alright, I've seen the comment in commit message - yet I prefer not to use Get|Set - is there anything specific that needs this Get|Set prefix?

Copy link
Member

Choose a reason for hiding this comment

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

This is valid also for Put (which recall me of HTTP for instance) - is it ok to use something like UploadManifest? SendManifest? I like it much more

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now the immediate barrier is that there already is a Manifest method. But #58 proposes renaming it to Inspect anyway…

Dropping the Get prefix is perfectly fine with me.

As for Put, Upload/Send are a bit weird with dirImageDestination; and generally ImageDestination may have ordering dependencies, e.g. see how openshiftImageDestination in https://github.com/mtrmac/skopeo/tree/openshift-annotation-sigs only stores signatures locally in PutSignatures and uploads them only in PutManifest. Upload/Send could be misleading in such a case — but honestly the whole ImageSource/ImageDestination will need to be rethought if we ever support non-seekable tarball streams.

Copy link
Member

Choose a reason for hiding this comment

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

For now the immediate barrier is that there already is a Manifest method. But #58 proposes renaming it to Inspect anyway…

this is indeed awesome and what I like

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 fine merging this as-is given we could remove at least Get (#57 (comment))

Copy link
Member

Choose a reason for hiding this comment

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

but honestly the whole ImageSource/ImageDestination will need to be rethought if we ever support non-seekable tarball streams.

agree, maybe they could be embedded directly in images and are available only as a mean of developing new internal source|destination exposed by types.Image directy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do think that the source/destination distinction is useful; but for sources, this PR already goes a long way towards most users using a types.Image and not caring about ImageSource at all (basically unless you need layer contents, in which case tarball streams and ordering etc. are really important, Image gives you the same information and the caching and parsing makes it the preferred interface.).

@runcom
Copy link
Member

runcom commented May 16, 2016

apart from my naming conventions nit - this LGTM

@mtrmac mtrmac mentioned this pull request May 16, 2016
@mtrmac
Copy link
Contributor Author

mtrmac commented May 16, 2016

See #58 for more context.

@runcom
Copy link
Member

runcom commented May 16, 2016

Merging, will defer #57 (comment) to #58

@runcom runcom merged commit d4eb69e into containers:master May 16, 2016
@mtrmac mtrmac deleted the api-for-signatures branch May 16, 2016 18:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants