jattsson opened a new issue, #14222:
URL: https://github.com/apache/apisix/issues/14222

   ### Description
   
   As an APISIX user, I want APISIX to ship one JWT library rather than two 
forks of it, so that fixes arrive once and it is clear which code handles my 
tokens.
   
   **Current state**
   
   `apisix-master-0.rockspec` pins `api7-lua-resty-jwt = 0.2.6-0`. 
`lua-resty-openidc = 1.9.3-1`, also a runtime dependency, requires 
`lua-resty-jwt >= 0.2.0`, which is 
[cdbattags/lua-resty-jwt](https://github.com/cdbattags/lua-resty-jwt). Both 
rocks install `resty/jwt.lua`, `resty/evp.lua` and `resty/jwt-validators.lua`, 
so which copy `require("resty.jwt")` returns depends on install order. 
`openid-connect.lua` already accounts for this: `client_jwt_assertion_alg` is 
limited to the algorithms both libraries can sign.
   
   **Why the fork may no longer be needed**
   
   APISIX moved to the api7 fork in #6847 (April 2022). At that time the 
original repository had been inactive since January 2021, and its next activity 
was not until mid-2023 and then 2026. That has changed: lua-resty-jwt has 
released 0.3.0 to 0.3.2 (March 2026) and 0.4.0 (October 2026), adding the 
remaining JOSE algorithms, JWK/JWK Set keys and per-call algorithm pinning 
(`verify_with`), with a hardening pass documented in its 
[CHANGELOG](https://github.com/cdbattags/lua-resty-jwt/blob/master/CHANGELOG.md).
   
   The api7 fork's last release is 0.2.6 (October 2024). Fixes merged in 
October 2026 (api7/lua-resty-jwt#18, #19, #21, #22, #23) are unreleased, and 
several of them address issues the original also fixed in 0.4.0. Maintaining 
both means the same work is done twice.
   
   **Proposal**
   
   Replace `api7-lua-resty-jwt = 0.2.6-0` with `lua-resty-jwt = 0.4.0-1` in the 
rockspec, leaving one provider of `resty.jwt`.
   
   APISIX's own use of the library is small:
   
   - `jwt:load_jwt` in `apisix/plugins/jwt-auth/parser.lua` and 
`apisix/plugins/openid-connect.lua` (parsing only; `jwt-auth` verifies 
signatures with `lua-resty-openssl`)
   - `jwt:sign` in `apisix/utils/google-cloud-oauth.lua`
   - indirectly, `lua-resty-openidc`
   
   **Things to check in the PR**
   
   - 0.4.0 has breaking changes. The relevant one here is strict parsing: 
`load_jwt` rejects tokens that are not canonical base64url (padding, the 
standard alphabet, extra parts). Issuers produce canonical tokens, but it is a 
behaviour change for `jwt-auth`.
   - 0.4.0 requires `lua-resty-openssl >= 1.1.0`, which APISIX already 
satisfies through `lua-resty-openidc`.
   - The `openid-connect` and `jwt-auth` test suites against 0.4.0, and whether 
`client_jwt_assertion_alg` can then be widened.
   
   If maintainers agree with the direction, I'm happy to open the PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to