@clerk/backend
3.29.0 · 14 Nov 2026MIT8.4M / weekRepositoryHomepagenpmAtom feed
2.33.9 is the newest release of 2.x.
In short
1 new1 fixed2 internal
Security
2 advisories affect 2.3.0; 2.33.3 fixes them
- HighClerk has an authorization bypass when combining organization, billing, or reverification checksGHSA-w24r-5266-9c3c · 30 Apr 2026Fixed in 2.33.3
- High@clerk/backend Performs Insufficient Verification of Data AuthenticityGHSA-9mp4-77wg-rwx9 · 9 Jul 2025Fixed in 2.4.0
Release note
Minor Changes
Optimize handshake payload delivery with nonce-based fetching
This change introduces a significant optimization to the handshake flow by replacing direct payload delivery with a nonce-based approach to overcome browser cookie size limitations.
Problem Solved
Previously, the handshake payload (an encoded JWT containing set-cookie headers) was sent directly in a cookie. Since browsers limit cookies to ~4KB, this severely restricted the practical size of session tokens, which are also JWTs stored in cookies but embedded within the handshake payload.
Solution
We now use a conditional approach based on payload size: - **Small payloads (≤2KB)**: Continue using the direct approach for optimal performance - **Large payloads (>2KB)**: Use nonce-based fetching to avoid cookie size limits For large payloads, we: 1. Generate a short nonce (ID) for each handshake instance 2. Send only the nonce in the `__clerk_handshake_nonce` cookie 3. Use the nonce to fetch the actual handshake payload via a dedicated BAPI endpoint
New Handshake Flow (for payloads >2KB)
1. User visits `example.com` 2. Client app middleware triggers handshake → `307 FAPI/v1/client/handshake` 3. FAPI handshake resolves → `307 example.com` with `__clerk_handshake_nonce` cookie containing the nonce 4. Client app middleware makes `GET BAPI/v1/clients/handshake_payload?nonce=<nonce_value>` request (BAPI) 5. BAPI returns array of set-cookie header values 6. Client app middleware applies headers to the response
Traditional Flow (for payloads ≤2KB)
No changes. Continues to work as before with direct payload delivery in cookies for optimal performance.
Trade-offs
- **Added**: One additional BAPI call per handshake (only for payloads >2KB) - **Removed**: Cookie size restrictions that previously limited session token size
Patch Changes
Ensure
__clerk_syncedis removed from cross-origin return-back urls
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.