NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #382 most downloaded on Packagist
JWT library
Latest stable
4.2.7
Last release 14 days ago
08 Nov 2026
Ships fairly regularly
a new release about every 2 months
Some releases are documented
notes for 26 of 50 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
50 releases · first in 2024
Drag across the ruler to compare, or tap a release to open it.
fix(key-mgmt): keep the JKU/X5U requests whose headers cannot be seri…
fix(key-mgmt): keep the JKU/X5U requests whose headers cannot be seri…
This project publishes no release notes. Between 4.2.6 and 4.2.7 there were 13 commits, 8 of them substantive:
Merge branch '4.1.x' into 4.2.x
Merge branch '4.1.x' into 4.2.x
This project publishes no release notes. Between 4.2.5 and 4.2.6 there were 25 commits, 22 of them substantive:
…and 2 more.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
fix(signature): a payload member that is present but empty is not a d…
fix(signature): a payload member that is present but empty is not a d…
This project publishes no release notes. Between 4.2.4 and 4.2.5 there were 1 commits, 1 of them substantive:
origin/4.1.x: Use strlen() in the code merged from 3.4.x, as everywhere else on the 4.x line Derive the full key length in the ECDH-ES Concat KDF Requ
This project publishes no release notes. Between 4.2.3 and 4.2.4 there were 8 commits, 5 of them substantive:
fix(composer): allow brick/math 1.0
fix(composer): allow brick/math 1.0 (#730)
This project publishes no release notes. Between 4.2.2 and 4.2.3 there were 1 commits, 1 of them substantive:
This project publishes no release notes. Between 4.2.1 and 4.2.2 there were 1 commits, 1 of them substantive:
This project publishes no release notes. Between 4.2.1 and 4.2.2 there were 1 commits, 1 of them substantive:
Merge pull request #698 from web-token/fix/jwe-builder-shared-header-…
Merge pull request #698 from web-token/fix/jwe-builder-shared-header-…
This project publishes no release notes. Between 4.2.0 and 4.2.1 there were 8 commits, 5 of them substantive:
JWSBuilder::withEncodedPayload() takes the payload in the form the caller already holds, instead of forcing a decode just so the builder can encode it
JWSBuilder::withEncodedPayload() takes the payload in the form the caller
already holds, instead of forcing a decode just so the builder can encode it
back. GNAP request signing is the case that asked for it: the payload there is
the Base64Url encoded SHA-256 hash of the request body.
Handing such a string to withPayload() encodes it twice and silently yields a
token whose payload nobody expects. The new method states the intent and checks
it: the value goes through Base64UrlSafe::decodeNoPadding(), so padding, the
Base64 alphabet, impossible lengths and non-canonical trailing bits are all
rejected. That is the strictness CompactSerializer already applies when
loading a token, so the builder cannot emit what the library itself refuses to
read back.
An encoded payload contradicts b64: false, which removes the encoding
altogether; the combination is rejected whichever order the two are set in.
The method, its name and the use case come from Aaron Parecki in #329.
Closes #329
Co-authored-by: Aaron Parecki aaron@parecki.com
This project publishes no release notes. Between 4.1.11 and 4.2.0 there were 11 commits, 8 of them substantive:
4.0.x: fix(core): repair the conditional swap of the elliptic curve points Refuse AES key wrapping keys shorter than the algorithm key size Decrypt ex
This project publishes no release notes. Between 4.1.10 and 4.1.11 there were 22 commits, 20 of them substantive:
origin/4.0.x: Use strlen() in the code merged from 3.4.x, as everywhere else on the 4.x line Derive the full key length in the ECDH-ES Concat KDF Requ
The compact JWS and JWE serializers split the whole input on every "." before checking the segment count, so a delimiter-heavy string was first expand
The compact JWS and JWE serializers split the whole input on every "."
before checking the segment count, so a delimiter-heavy string was first
expanded into one array entry per delimiter. That costs about 25 times
the size of the input in memory: a 2 MB token allocates ~48 MB before it
is rejected as malformed.
The split is now bounded to one more segment than a valid token has,
which is enough to detect and reject longer input while keeping the
allocation proportional to the token itself. The accepted and rejected
inputs are unchanged.
Reported by Team Atlanta.
The compact JWS and JWE serializers split the whole input on every "." before checking the segment count, so a delimiter-heavy string was first expand
The compact JWS and JWE serializers split the whole input on every "."
before checking the segment count, so a delimiter-heavy string was first
expanded into one array entry per delimiter. That costs about 25 times
the size of the input in memory: a 2 MB token allocates ~48 MB before it
is rejected as malformed.
The split is now bounded to one more segment than a valid token has,
which is enough to detect and reject longer input while keeping the
allocation proportional to the token itself. The accepted and rejected
inputs are unchanged.
Reported by Team Atlanta.
Merge branch '4.0.x' into 4.1.x
Merge branch '4.0.x' into 4.1.x
Mise à jour de la contrainte de version de brick/math pour inclure le…
Mise à jour de la contrainte de version de brick/math pour inclure le…
Fix PHP 8.5 deprecation
Fix PHP 8.5 deprecation (#648)
Fix PHP 8.5 deprecation
Fix PHP 8.5 deprecation (#648)
Fix PHP 8.5 deprecation
Fix PHP 8.5 deprecation (#648)
Add GitHub Action to auto-switch default branch on new tags
Add GitHub Action to auto-switch default branch on new tags
Refactor command help text definitions for Symfony Console compatibil…
Refactor command help text definitions for Symfony Console compatibil…
Nothing published for this version
Point is a readonly class, but Point::cswap() took its properties by reference to swap them in place. Every call raised "Cannot indirectly modify read
Point is a readonly class, but Point::cswap() took its properties by
reference to swap them in place. Every call raised "Cannot indirectly
modify readonly property", which made Curve::mul() unusable and, with it,
Curve::createPublicKey(), Curve::getPoint() with an order and
EcDH::computeSharedKey(). Every curve was affected.
Nothing failed in production because AbstractECDH::calculateAgreementKey()
tries openssl_pkey_derive() first and swallows the pure PHP fallback in a
catch (Throwable): the fallback had simply never run.
cswap() now returns the two points instead of mutating them. The masked XOR
exchange itself is unchanged.
The twelve baseline entries that hid the problem, among them "Readonly
property Point::$x is assigned outside of the constructor", are dropped.
(cherry picked from commit 4c2232f347c0785d48c0581030ab4fddb5fe5a7d)
Use strlen() in the code merged from 3.4.x, as everywhere else on the…
Use strlen() in the code merged from 3.4.x, as everywhere else on the…
3.4.x: Update signature tests for the protected-header "alg" requirement (#651) Merge commit from fork Merge commit from fork Merge commit from fork M
psr/cache v2 (#620)Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
AESKW and AESGCMKW (A128KW, A192KW, A256KW, A128GCMKW, A192GCMKW and A256GCMKW) handed the decoded "k" of the oct key to OpenSSL without comparing its
AESKW and AESGCMKW (A128KW, A192KW, A256KW, A128GCMKW, A192GCMKW and
A256GCMKW) handed the decoded "k" of the oct key to OpenSSL without
comparing its length with the key size of the algorithm. PHP's OpenSSL
extension does not reject a key of another size: it pads a shorter key
with zero bytes and only uses the first 16, 24 or 32 bytes of a longer
one. An empty key, which JWKFactory::createFromSecret() returns for an
empty string, wrapped every CEK under an all-zero key: anyone could read
the tokens the application issued and forge tokens it accepted, and a
shorter key was completed with zero bytes. The experimental A128CTR,
A192CTR, A256CTR and chacha20-poly1305 key encryption algorithms had the
same flaw.
A key shorter than the key size of the algorithm is now refused with
"Invalid key length.", as HS256, HS384 and HS512 already do: the builder
throws and the decrypter moves on to the next key of the set. An AESKW
subclass with a wrapper of another library, or an AESCTR subclass with
another cipher, is not checked.
A key of the key size or longer is used as before, so tokens issued with
such keys are not affected. Tokens issued with a shorter key can be read
again with that key padded with zero bytes to the key size of the
algorithm.
Reported by Anthropic's OSS Scanner (ANT-2026-A3MHD339).
commit 'bb2b9d55': Derive the full key length in the ECDH-ES Concat KDF
AESGCM::decryptContent() and AESGCMKW::unwrapKey() handed the tag taken from the token to openssl_decrypt() without checking its length. OpenSSL compa
AESGCM::decryptContent() and AESGCMKW::unwrapKey() handed the tag taken
from the token to openssl_decrypt() without checking its length. OpenSSL
compares only as many bytes as it is given, so a tag truncated to a single
byte was verified on 8 bits. GCM being a counter mode, the holder of one
valid JWE could flip ciphertext bits and find an accepted one-byte tag
within 256 attempts, getting a modified plaintext accepted as authentic.
Both methods now reject a tag that is not 16 bytes long before calling
OpenSSL, with the same exception as any other authentication failure.
RFC 7518 fixes the tag at 128 bits for A128GCM, A192GCM and A256GCM
(section 5.3) and for the "tag" header parameter of A128GCMKW, A192GCMKW
and A256GCMKW (section 4.7.1.2), so tokens from conforming producers are
not affected.
JWSVerifier::getAlgorithm() merged the protected and unprotected headers with [...$protected, ...$unprotected]; with duplicate keys PHP keeps the LAST
JWSVerifier::getAlgorithm() merged the protected and unprotected headers
with [...$protected, ...$unprotected]; with duplicate keys PHP keeps the
LAST value, so the attacker-controlled unprotected header could override
the integrity-protected "alg". Combined with HeaderCheckerManager (which
validates "alg" from the protected header), this is a TOCTOU
algorithm-confusion / downgrade vector (e.g. forcing HS256 against an RSA
public key, or HS512 -> HS256), and "alg" placed only in the unprotected
header bypassed the duplicate-parameter check entirely.
Per RFC 7515 §4.1.1 "alg" MUST be integrity protected. getAlgorithm() now
reads "alg" exclusively from the protected header and rejects a JWS whose
"alg" is absent from (or present only outside) the protected header.
Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com
Add sodium support for Base64 URL safe encoding/decoding
Add sodium support for Base64 URL safe encoding/decoding (#644)
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per month.