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

fix(jwt): remove chances to base64 decode a rsa_public_key #13717

Merged
merged 5 commits into from
Nov 18, 2024

Conversation

jizhilong
Copy link
Contributor

@jizhilong jizhilong commented Sep 28, 2024

Summary

never base64 decode a rsa public key

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • [ ] There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix #13710

@CLAassistant
Copy link

CLAassistant commented Sep 28, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added plugins/jwt cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Sep 28, 2024
@team-gateway-bot team-gateway-bot added the author/community PRs from the open-source community (not Kong Inc) label Sep 28, 2024
@pull-request-size pull-request-size bot added size/M and removed size/S labels Sep 28, 2024
Copy link
Member

@gszr gszr left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, @jizhilong! The fix looks good to me. @bungle could you also take a look?

@gszr gszr requested a review from bungle November 12, 2024 20:59
@gszr gszr merged commit dcf89f3 into Kong:master Nov 18, 2024
26 checks passed
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

@gszr
Copy link
Member

gszr commented Nov 18, 2024

@jizhilong please claim your Kong Contributor digital badge over here https://docs.google.com/forms/d/e/1FAIpQLSfacQHac-PYIDIrDOi_W2l7cWxBDRIVBs6xE5HnlojPvdhL9g/viewform.

@t-yuki
Copy link

t-yuki commented Nov 19, 2024

I guess this PR breaks current running gateways already deployed with base64-encoded keys.

@jizhilong
Copy link
Contributor Author

I guess this PR breaks current running gateways already deployed with base64-encoded keys.

@t-yuki

  • for JWT plugins configured properly, and already running as expected, this patch will not change their behavior.
  • for the original JWT plugins configured with asymmetric encryption and conf.secret_is_base64=true(just like [JWT plugin] RSA256 return message:Invalid key/secret #2891), the HTTP response codes may change from all 403 to partially 2xx. If the 403 was intentionally set by the administrator(relying a bug to block requests), this patch could indeed pose some security risks. I believe such scenario is quite rare in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author/community PRs from the open-source community (not Kong Inc) cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee plugins/jwt size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

validation rule for jwt_secrets.rsa_public_key is inconsistent between the write side and consume side
6 participants