Skip to content

Conversation

arubegonsan
Copy link

Summary

This commit introduces a new --payload-media-type flag to the cosign sign command.

When signing with a custom payload using the --payload flag, users can now also specify the MIME type of that payload via --payload-media-type.

This media type is then stored in the mediaType field of the signature layer descriptor in the resulting OCI manifest. This allows consumers of the signature to correctly interpret the payload's content type.

If --payload is not used, this flag is ignored.

Release Note

Documentation

Needs documentation change.

@arubegonsan arubegonsan requested a review from a team as a code owner July 23, 2025 16:27
This commit introduces a new `--payload-media-type` flag to the
`cosign sign` command.

When signing with a custom payload using the `--payload` flag, users can
now also specify the MIME type of that payload via `--payload-media-type`.

This media type is then stored in the `mediaType` field of the signature
layer descriptor in the resulting OCI manifest. This allows consumers of
the signature to correctly interpret the payload's content type.

If `--payload` is not used, this flag is ignored.

Signed-off-by: Alberto Gonzalez <albgonz@google.com>
Copy link
Contributor

@cmurphy cmurphy left a comment

Choose a reason for hiding this comment

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

Could you add a test for this?


var s icos.Signer
s = ipayload.NewSigner(sv)
var staticOpts []static.StaticOption
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the majority of the changed lines in this PR come from renaming this type. It's creating a lot of noise, and you'll find that it trips up the linter because it creates a "stutter". I don't think it's necessary to rename it because it's clear what it's for based on the package name. Could you undo this rename?

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.

cosign sign --payload hardcodes layer MIME to application/vnd.dev.cosign.simplesigning.v1+json

2 participants