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

[root v11] KMS keyid for timestamp/snapshot should be fixed #1347

Open
jku opened this issue Aug 31, 2024 · 3 comments
Open

[root v11] KMS keyid for timestamp/snapshot should be fixed #1347

jku opened this issue Aug 31, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jku
Copy link
Member

jku commented Aug 31, 2024

EDIT: the immediate issue was worked around: this is now open until the key in metadata is modified so the online-uri for the timestamp/snapshot key is correct.
The value is gcpkms://projects/sigstore-root-signing/locations/global/keyRings/root/cryptoKeys/timestamp which is what the old workflows used. IT should be
gcpkms:projects/sigstore-root-signing/locations/global/keyRings/root/cryptoKeys/timestamp/cryptoKeyVersions/1

original issue follows:


We tried merging the migration signing event on friday. This failed since the KMS keyid is incorrect:

  • I used projects/sigstore-root-signing/locations/global/keyRings/root/cryptoKeys/timestamp since that is what the legacy workflows use
  • The KeyManagementServiceClient.asymmetric_sign() in GCP KMS python bindings requires the full keyid however -- there should be a version identifier included in the string
  • this error could not happen with tuf-on-ci normally (since the public key is fetched from GCP API with the keyid when the key is inserted in the metadata) but in this import case this check does not happen

Next steps:

  • verify the correct keyid
  • decide on how to fix: I initially thought keyholders will have to resign but it is possible we could add a code workaround -- this would allow us to move fast and hopefully not break more things
@jku jku added the bug Something isn't working label Aug 31, 2024
@jku jku self-assigned this Aug 31, 2024
@jku
Copy link
Member Author

jku commented Aug 31, 2024

The legacy signing uses sigstore/sigstore to sign: that just picks the highest version number available: see code -- this is IMO incorrect for TUF (since a new keyversion is a really an entriely different key that will no longer match the public key in the metadata) but explains the different keyid usage.

I believe we cannot see from logs which key version is actually used in the legacy online-signing.

verify the correct keyid

It seems I do not personally have the permissions to do this with gcloud:

from google.cloud import kms
client = kms.KeyManagementServiceClient()
request = {"name": "projects/sigstore-root-signing/locations/global/keyRings/root/cryptoKeys/timestamp/cryptoKeyVersions/1"}
client.get_public_key(request)

...

google.api_core.exceptions.PermissionDenied: 403 Caller does not have required permission to use project sigstore-root-signing. Grant the caller the roles/serviceusage.serviceUsageConsumer role, or a custom role with the serviceusage.services.use permission

There is a tuf_key_viewers variable defined in scaffolding but I'm not sure where that should be set

@jku
Copy link
Member Author

jku commented Sep 2, 2024

There is a workaround in tuf-on-ci: we will re-try the signing event merge in #1348

This issue should remain open even after that so we can properly fix the KMS keyid in the next signing event

@jku
Copy link
Member Author

jku commented Sep 2, 2024

The workaround seems to have worked -- although next issues is still preventing seeing the results (see #1349)

@jku jku changed the title KMS keyid issue in migration signing event [root v11] KMS keyid for timestamp/snapshot should be fixed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant