JWT zip Header
The zip header parameter indicates that the plaintext of a JWE was compressed before encryption. A common value is DEF for DEFLATE compression. Compression can shrink large payloads but interacts poorly with secrets: compressing attacker-controlled data together with confidential data can leak information through ciphertext length in ways similar to classic compression side channels discussed in other protocols. Most signed JWTs used as bearer access tokens do not use zip at all. If you adopt JWE with zip, ensure libraries negotiate parameters safely and avoid compressing confidential fields alongside adversary-influenced inputs. Prefer short tokens and encrypt only when confidentiality requirements truly demand JWE rather than signed JWS alone.
Why It Matters
Teams sometimes enable compression to fit tokens into cookies without understanding cryptographic side channels and operational complexity. For typical API bearer tokens, skip zip and keep payloads small by deliberate claim design. When building encrypted tokens, follow library guidance and threat-model compression carefully before enabling zip in any production issuer configuration that handles sensitive personal data. Default access tokens to uncompressed JWS with minimal claims. Enable zip only after a written threat model for compressed-then-encrypted payloads, and keep adversary-controlled fields out of the same compression context as secrets.
Related Terms
Related Comparisons
Related Tools
Related Articles
Frequently Asked Questions
Do access tokens need zip?
Almost never. Keep claims minimal instead of compressing. zip mainly appears in certain JWE profiles with large plaintexts, not typical bearer access tokens.
Is compression before encryption always safe?
No. Compressing attacker-influenced data together with secrets can leak information via ciphertext length. Threat-model zip carefully or avoid compression for confidential JOSE payloads.
Who sets the zip header?
The issuer sets zip when producing JWE. Verifiers must understand the declared compression; unknown zip values should fail closed rather than guessing.