-
Notifications
You must be signed in to change notification settings - Fork 158
[feat]: add support for EC/ED25519 public keys for token authentication #2998
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
Conversation
021eda7 to
24acd0f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2998 +/- ##
==========================================
+ Coverage 90.99% 91.00% +0.01%
==========================================
Files 175 176 +1
Lines 32798 32900 +102
==========================================
+ Hits 29843 29940 +97
- Misses 2232 2234 +2
- Partials 723 726 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@evanebb thanks for this PR. Pls address the CI failures. |
andaaron
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is much cleaner compared to what we had before.
Please make sure to add relevant tests and reach the coverage threshold.
|
@evanebb when you are ready, move it out of draft and mark it ready for review. |
|
@rchincha done, I wanted to do a bit more manual testing before doing so. Something that could cause problems is that the old code would also accept a file containing a public key for the (also, I noticed that the CI will intermittently fail with a |
Signed-off-by: evanebb <[email protected]>
Signed-off-by: evanebb <[email protected]>
Signed-off-by: evanebb <[email protected]>
…es ED25519 certificate handling Signed-off-by: evanebb <[email protected]>
Signed-off-by: evanebb <[email protected]>
Signed-off-by: evanebb <[email protected]>
Signed-off-by: evanebb <[email protected]>
Signed-off-by: evanebb <[email protected]>
Signed-off-by: evanebb <[email protected]>
Pulls the validation in-line with the old library Signed-off-by: evanebb <[email protected]>
468d7dd to
199148c
Compare
Some flaky tests, we just have to arbitrate free ports. |
What type of PR is this?
feature
Which issue does this PR fix:
#2587
What does this PR do / Why do we need it:
Currently the
github.com/chartmuseum/authpackage is used for token authentication, which only supports RSA keys. It also doesn't seem to be updated anymore, and uses a pretty old version of thegolang-jwtpackage which could use a bump.I have ripped out the important bits and re-implemented the token handling directly using
golang-jwt, which allows it to support EC/ED25519 keys as well as RSA keys.Testing done on this change:
In addition to the added automated tests, I have done some manual testing by spinning up a local Zot instance + authorization server. I tested using an RSA (RS256), ECDSA (ES256) and ED25519 key/certificate, did some API calls with tokens signed using these keys and some logins/pushes/pulls using the Docker CLI. This all seemed to work just fine.
Automation added to e2e:
Will this break upgrades or downgrades?
It shouldn't, I've tried to keep the behavior as close to what it was before as possible, but I can't guarantee it (there are some more improvements I could think of, but I don't want to break backward compatibility completely).
Does this PR introduce any user-facing change?:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.