Add support for registry v3 JWK thumbprint key ID format #401
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.
Fixes #386.
This is a fairly quick and dirty fix, feel free to burn this PR down :)
As mentioned in that issue, the v3 version of the registry no longer supports
libtrust
key IDs. There are multiple alternative options to choose from, but the simplest one to implement for this project is using the JWK thumbprint of the public key as the key ID instead.For every certificate present in the
rootcertbundle
passed to the registry, it'll add the public key to the trusted keys identified by the JWK thumbprint: https://github.com/distribution/distribution/blob/63d3892315c817c931b88779399a8e9142899a8e/registry/auth/token/accesscontroller.go#L346-L348So, if you pass this JWK thumbprint in the key ID header in the token, the registry can select the proper signing key using this thumbprint.
This PR allows configuring this through a new directive in the configuration file, namely
token.disable_legacy_key_id
.If set to true, it will pass the JWK thumbprint in the key ID header instead of the
libtrust
key ID. It defaults to false for now, to avoid accidental breakage when updating setups using the v2 registry.