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

Cosign should check Media Type of the layer before download of the signature #3669

Open
Mukuls77 opened this issue Apr 17, 2024 · 2 comments · May be fixed by #3670
Open

Cosign should check Media Type of the layer before download of the signature #3669

Mukuls77 opened this issue Apr 17, 2024 · 2 comments · May be fixed by #3670
Labels
enhancement New feature or request

Comments

@Mukuls77
Copy link
Contributor

Description

During signature verification cosign calculates the signature tag by using the artifact digest. ArtifactPath:sha256-Artifact Digest.sig
Using this tag cosign download the signature manifest.
once signature manifest is downloaded cosign start downloading the layers mentioned in the signature manifest file.
There should be a check to verify the Media Type of the layers it is downloading is matching to the expected media type of a signature layer "application/vnd.dev.cosign.simplesigning.v1+json"

Why this check is important is that if someone by mistake apply the signature Tag to an artifact which is not really a signature than cosign will start downloading all the layers present in that artifact to which Signature Tag is applied by mistake.
This can account to a huge download of data in cosign memory and eventually cosign will fail verification because the data was not actually a signature.
So proposed enhancement is to check MediaType before download of layers this will stop the erroneous layer download.
This will save from wrong data download and memory consumption.
This will also make system more robust for a change done by mistake in Registry related to signature tags

@Mukuls77 Mukuls77 added the enhancement New feature or request label Apr 17, 2024
@Mukuls77 Mukuls77 linked a pull request Apr 18, 2024 that will close this issue
@loosebazooka
Copy link
Member

Is there an actual example of this? Or we just preventing some sort of malicious denial of service?

@Mukuls77
Copy link
Contributor Author

Is there an actual example of this? Or we just preventing some sort of malicious denial of service?

We were able to recreate this scenario by just moving the TAG of a signature to any other big artifact in the registry. this PR want to make sigstore more robust for any such scenarios which can happen by someone either by accident apply signature TAG on a non signature artifact or it could be a planned malicious attack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants