feat: support providing the cosign public key via GitHub Secrets - #156
Merged
Conversation
This removes the need to store cosign.pub in the repository, allowing cloned or forked repositories to use independent signing keys without modifying tracked files.
HastD
suggested changes
Jul 25, 2026
HastD
left a comment
Contributor
There was a problem hiding this comment.
I'm not sure if this is a good idea; isn't it best practice to commit the public key to the repo? That way there's a public record of the public key that was used, which allows people to verify the signature on the images. (Otherwise, you'd have to provide the public key through some out-of-band mechanism like posting it in the readme or a separate website.) And for testing on a fork, you can just create a branch that uses a different cosign.pub.
As for the actual implementation, it looks correct aside from a couple minor issues, noted below.
gmpinder
approved these changes
Jul 29, 2026
gmpinder
left a comment
Member
There was a problem hiding this comment.
I think this would be a reasonable addition so long as the backward compatibility is still a thing.
HastD
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This removes the need to store
cosign.pubin the repository by allowing the public key to be provided through GitHub Secrets.The current approach can create unnecessary conflicts for forks and downstream repositories, since
cosign.pubbecomes a tracked file that must be replaced whenever a different signing key is used.I encountered this while maintaining multiple repositories with independent signing identities. A cloned or forked repository required replacing
cosign.pub, causing persistent diffs and potential merge conflicts unrelated to the actual code changes.This change preserves full backward compatibility:
cosign.pubexists in the repository, the current behavior is unchanged.cosign_public_keyis provided, the action creates a temporarycosign.pubfile during the workflow execution.The implementation is intentionally minimal, requiring only:
cosign_public_key)This allows forks, clones, and downstream repositories to use independent signing keys without modifying tracked files.
Backward compatibility: fully preserved.
This feature is optional and does not change the behavior of existing repositories that already track
cosign.pub.