Repository navigation
rgw/sts: Implementation of validating JWT using modulus and exponent - #61796
Conversation
|
bfc6948 to
2abd810
Compare
|
@mdw-at-linuxbox Take a look at this if you could, please. |
|
The latest version of jwt-cpp library which we use already has support for n&e validation. We should update the library instead of writing custom code in order to make it easier to rebase in the future if we want to pull in further fixes. I did this in commit 2427bfa so feel free to copy/use as reference. |
|
Also, which trackers does this address. I see the checkbox is ticked but no trackers are mentioned in description. |
|
Given the overlap between this PR and #60985, maybe we should create a baseline PR that just introduces N&E validation and then addresses further changes in the future. This seems like a way to proceed and have smaller targeted fixes as I believe both PRs perhaps try to address too much. Any thoughts? |
Please check the individual commits |
This PR has segregated changes into separate commits, but all of them together address the N&E changes. I will check the new jwt-cpp library and cherry-pick the changes from 2427bfa if needed. |
have you had a chance to look at this, @pritha-srivastava? |
|
@pritha-srivastava, to move forward, we could have an PR that just has commit 2427bfa to update the library. The update contains support for bare key validation and rebase our PRs on top of the new library. Any thoughts? |
@cbodley : I will take a look shortly, by next week. |
@cbodley @awojno-bloomberg : I am planning to cherry-pick 2427bfa and parts of 277cd24 onto this PR. And then test these changes as this PR in its current form has been tested. |
Thoughts on doing some incremental PR's with targetted changes so that we are not bundling all these changes? @pritha-srivastava - appreciate the help on this! - the fix that @awojno-bloomberg is chasing is blocking a several things for us and we are hoping not to patch things downstream. We always try and follow the best practice of getting things in upstream first! 😄 |
|
It seems like we should indeed be pulling up the JWT library. @pritha-srivastava could you pull up your PR here and thumprint verification, on to @awojno-bloomberg 's commit(s) pulling up JWT? |
|
|
i created a 'rgw cleanup' task in https://tracker.ceph.com/issues/70910 to use a git submodule for src/rgw/jwt-cpp, but that doesn't need to block progress here |
2abd810 to
a0b931b
Compare
|
@mattbenjamin @cbodley : I have updated the PR and performed developer level testing and it works. I will schedule a teuthology run to ensure there are no regressions. Please note: since we are not using an https url for keycloak, we can not test this in teuthology |
There was a problem hiding this comment.
isn't there a matching catch somewhere that's going to log this message again?
There was a problem hiding this comment.
will check
There was a problem hiding this comment.
i'm not sure we want any of these errors logged at level 0. this is all happening during AssumeRoleWithWebIdentity, right? we should instead be sending good error messages back to the client via s->err.message
There was a problem hiding this comment.
authenticate() method is the entry point which takes in req_state as a const pointer. Can I remove const from it? Or is there an alternative way by which we can return error messages from the authentication() step
There was a problem hiding this comment.
hmm, right.. on error from one auth engine, we might fall back to another engine and succeed or fail differently. so auth engines probably shouldn't set error messages directly
i suppose we could extend rgw::auth::Engine::AuthResult to include an optional "message" string? rgw::auth::Strategy::authenticate() returns the "final" AuthResult, so rgw::auth::Strategy::apply() could assign that message to s->err.message
that design could also avoid the special cases we added there for ERR_PRESIGNED_URL_EXPIRED/ERR_PRESIGNED_URL_DISABLED
i don't want to block progress here though. if it gets complicated, maybe we can defer those changes to a followup pr. what do you think?
There was a problem hiding this comment.
Yes rgw::auth::Strategy::apply() is the place to assign the error message, and rgw::auth::Engine::AuthResult is the correct place to add a variable to hold the message. and we can track these changes in a separate tracker as you suggested as this might affect other auth engines also. So for now, I will bump up the log levels from 0 atleast. And if you have any other comments on the current PR, let me know.
There was a problem hiding this comment.
@cbodley : did you get a chance to create a tracker for this? shall I create one if you didnt.
There was a problem hiding this comment.
thanks for the reminder, opened https://tracker.ceph.com/issues/71081
a0b931b to
b228f74
Compare
|
Are there any new unit or integration tests we can add to test the new features? |
|
Ran this PR through teuthology to rule out any regressions and the sts tests have passed: https://pulpito.ceph.com/prsrivas-2025-04-20_16:18:09-rgw:sts-wip-rgw-sts-n-e-pritha-distro-default-smithi/ |
ad2f214 to
6d52a10
Compare
|
Hi @cbodley , @adamemerson , @pritha-srivastava , |
6d52a10 to
0080e85
Compare
|
@cbodley @adamemerson : I've updated the PR with the log statement that I wanted to add, and it is now ready to be merged. |
this should be merged today (provided all jenkins tests pass). |
|
jenkins test make check |
|
jenkins test make check arm64 |
|
make check failures |
|
make check arm64 failures: the failures do not look related to this PR @cbodley @adamemerson |
using modulus and exponent for RSA group of algorithms. A couple of issues and a fix have been suggested by Pupu Toivonen ([email protected]) in signature calculation using modulus and exponent. Fixes: https://tracker.ceph.com/issues/51018 Signed-off-by: Pritha Srivastava <[email protected]>
'sig' for signature validation of the token. Fixes: https://tracker.ceph.com/issues/54562 Signed-off-by: Pritha Srivastava <[email protected]>
to https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_verify-thumbprint.html for n&e which can be later used for all key types (x5c, n&e). Signed-off-by: Pritha Srivastava <[email protected]>
if aud is not present in JWT. Signed-off-by: Pritha Srivastava <[email protected]>
0080e85 to
b5bbeb7
Compare
|
rebasing with latest main, to see if make check failures go away |
|
not sure why make check arm64 has failed, the build has succeeded, the tests have passed, still see the following: |
|
jenkins test make check arm64 |
|
@cbodley @adamemerson all required tests have passed, this is ready to be merged. Check for missing .qa links job seems to be running forever |
|
@pritha-srivastava does this need backports all the way to reef? this pr resolved two issues (https://tracker.ceph.com/issues/51018 and https://tracker.ceph.com/issues/54562), so we should choose one to use for backports. the 'tentacle' branch forked on friday, so we'll need to backport there too |
|
https://tracker.ceph.com/issues/54562 can be used for backports till reef. these issues are long outstanding |
thanks, moved that one to Pending Backport and the other to Resolved |
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e