Repository navigation
Diffing, SD-JWTs, JSON Serialization, and batch mode
This release adds four ways to work with tokens: compare two tokens semantically, decode Selective Disclosure JWTs, read JWS and JWE tokens in JSON Serialization, and process many tokens in one run. It also includes the fixes from a security audit of these features.
What's new
jwtd diff. jwtd diff <tokenA> <tokenB> compares two tokens field by field instead of as text.
- Output: added (
+), removed (-), and changed (~) header and payload fields.--allalso shows unchanged fields. - Timestamps:
iat,exp,nbf,auth_time, andupdated_atshow signed deltas such as(+1h). The--local/--tztimezone flags apply. - Keys:
--keyand--verify-keyapply to both tokens. A JWK Set verifies tokens acrosskidrotations, and encrypted or nested tokens are decrypted before they are compared. - Scripting:
--exit-codeexits 1 when the tokens differ.--jsonemits a machine-readable diff.-reads one of the two tokens from stdin. - Fails closed: two undecrypted JWEs with different ciphertexts are never reported equal. An SD-JWT whose disclosures do not bind never compares equal to anything.
SD-JWT (RFC 9901). Tilde-separated Selective Disclosure JWTs are detected automatically.
- Disclosures: every disclosure is checked against its digest, recursively and inside arrays, with
sha-256,sha-384, orsha-512. The disclosed claims are merged into the payload. A tampered, duplicated, conflicting, or unreferenced disclosure fails with a nonzero exit. - Key Binding JWTs are checked for
typ, an asymmetricalg, the required claims with their types, andsd_hash. Their signature is verified againstcnf.jwkonly after the issuer signature verified against your--key, because a holder key the issuer did not vouch for proves nothing. - Works everywhere: claim validation,
--claim/--payload,--json, nesting inside a JWE, andjwtd diffall use the reconstructed claims.
JWS and JWE JSON Serialization. Flattened and General JSON Serialization (RFC 7515 / RFC 7516 §7.2) is detected alongside compact tokens. Pretty-printed JSON can be piped in as is.
- JWS: protected and unprotected headers are shown, and every signature is verified on its own. In a multi-signature token, a signature your key does not apply to is reported as
not checkedinstead ofINVALID, so one signer's key can verify that signer's signature. - JWE: the shared and per-recipient headers and the AAD are shown. Multi-recipient tokens are decrypted using each recipient's
kidandalg. - Raw JWS payloads: a compact JWS carrying a non-JSON payload now decodes, verifies, and extracts with
--payload. Claim checks and--claimfail on it, because it holds no claims.
--stream. Process newline-delimited tokens from stdin, for example from logs.
- Output: human output separates tokens with
---.--jsonemits NDJSON.--claimextracts one value per valid token. - Errors: processing continues past bad lines. Errors and verdicts on stderr name the line they came from. The exit status is nonzero at the end if any token failed.
- Interactive: on a terminal,
jwtd --streamprompts in a loop until an empty line,exit, or Ctrl+D.
Behaviour changes
- JWS extensions are refused. jwtd implements no JWS extension, so a token whose header carries
critis rejected, as RFC 7515 §4.1.11 requires. So is an RFC 7797 unencoded payload ("b64": false). Before, such a token's payload was base64url-decoded like any other, so a payload the issuer never signed could verifyVALID. - Tokens nested in a JWE must be clean. A decrypted payload opens as a nested token only when it contains nothing but token characters; surrounding whitespace is trimmed. A line break inside a segment used to parse and reach the terminal raw. Such a payload is now shown as text.
- Deep nesting is indented less. Indentation stops growing at 64 levels in both the regular and the
diffoutput. Deeper content is still printed in full. A 40 KB token nested 5,000 levels deep used to print 50 MB; it now prints 1.3 MB. - Verdict reasons are always escaped. Every reason printed after a verdict goes through the terminal escaper, so token-supplied text cannot forge a verdict line.
What's Changed
- docs: clear release notes after 5.10.0 by @bsg62 in #45
- feat: add jwtd diff subcommand for semantic token diffing by @bsg62 in #46
- feat: add RFC 9901 SD-JWT decoding, verification, and key binding support by @bsg62 in #47
- feat: support JWS/JWE JSON Serialization and raw non-JSON JWS payloads by @bsg62 in #48
- feat: add --stream mode for newline-delimited batch decoding and interactive loops by @bsg62 in #49
- fix: address security audit findings H1–H5, M2–M4 by @bsg62 in #50
- fix: address remaining security audit findings M1, M5, L1–L6 by @bsg62 in #51
- docs: add 2026-12-01 security audit with resolution status by @bsg62 in #52
- docs: draft release notes and update agents file lists by @bsg62 in #53
- docs: prepare 5.11.0 website by @bsg62 in #54
Full Changelog: v5.10.0...v5.11.0