Repository navigation
0.4.0 is a security release. Everyone on 0.3.x and earlier should upgrade. It fixes seven vulnerabilities, one of them critical. Several changes are breaking: read Upgrading from 0.3.x before you deploy.
Security
| Advisory | Severity | Affected |
|---|---|---|
| GHSA-85rg-93pf-mg8c: forged JWE accepted when a public key is used as the PBES2 password | Critical | 0.3.0–0.3.2 |
| GHSA-8g6x-8538-rvj8: remote nginx worker crashes in the OpenSSL FFI layer | High | < 0.4.0 |
| GHSA-c526-qc23-r353: unbounded PBES2 iteration count; algorithm whitelist not applied to JWE | High | 0.3.0–0.3.2 |
| GHSA-wm36-g7wp-x24w: RSA/EC public key accepted as an HMAC secret | High | < 0.4.0 |
| GHSA-gvf3-mm6g-94wp: AES-GCM tag length not enforced | Medium | 0.2.3–0.3.2 |
| GHSA-4jwm-wqj5-pr89: AES-CBC-HMAC decrypted before its tag was checked | Medium | < 0.4.0 |
| GHSA-v6j5-wh7j-2ggg: token malleability through non-canonical serializations | Medium | < 0.4.0 |
Highlights
- Safer verification by default: algorithms are bound to key types and EC curves, key material is refused as an HMAC secret, claims are checked only after the signature, compact tokens are parsed strictly, and
critfails closed. Pin algorithms per call with the newjwt:verify_with(secret, token, { algorithms = { "RS256" } }). - JWE hardening: exact tag and IV lengths, CBC-HMAC tags checked before decryption, one generic failure reason, the alg whitelist applied to JWE, bounded PBES2 work, and RFC 7518-correct ECDH-ES key wrapping.
- New: JWK/JWKS keys and reusable key objects (
jwt:load_key,resty.jwt.jwkwith RFC 7638 thumbprints), claim validators (audience,issued_at/max_age,jti_hook,required_claims), header validators, a configurable sign-sidetypwhitelist, and opt-in JWE compression (jwt:register_zlib_compression()). - Requirements:
lua-resty-openssl>= 1.1.0 (OPM >= 1.2.0).
See the full CHANGELOG for every breaking change, addition and fix.
Credits
Thanks to @spacewander (#73, and the original strict-split work in api7/lua-resty-jwt#1), @jattsson (#71, #72), @tzssangglass (api7/lua-resty-jwt#2) and @splitice (per-instance evp objects). This release also builds on earlier work by @adanegit, @yciabaud and @ObeydKhan.