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

repo: Add workaround for sigstore KMS keyid #423

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions repo/tuf_on_ci/_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ def close(self, rolename: str, md: Metadata) -> None:
for key in self._get_keys(rolename):
if rolename in ["timestamp", "snapshot"]:
uri = key.unrecognized_fields[TAG_ONLINE_URI]

# FIXME: workaround for issue #422, only needed while sigstore
# root-signing online key keyid is incorrect
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this hard coded rewrite, how about a version that detects invalid format (wrong scheme and missing version) and use that before instantiating the key via Signer.priv_key_from_uri?

if (
uri
== "gcpkms://projects/sigstore-root-signing/locations/global/keyRings/root/cryptoKeys/timestamp"
):
uri = "gcpkms:projects/sigstore-root-signing/locations/global/keyRings/root/cryptoKeys/timestamp/cryptoKeyVersions/1" # noqa: E501

signer = Signer.from_priv_key_uri(uri, key)
md.sign(signer, True)
else:
Expand Down