JWT and JOSE
The IETF JOSE specifications define signed (JWS), encrypted (JWE) and key (JWK) formats, and JWT (RFC 7519) puts claims inside them. RFC 8725 and its pending update list the ways JWT validation goes wrong. With this skill the agent issues and verifies JWTs, chooses algorithms and keys, and reviews library settings against those rules.
Follow the workflow below step by step. Every rule here comes from a source in Sources, with the section it cites. When a rule and the pinned source disagree, the source wins; when the source has a newer revision than the pin, follow the refresh steps.
Inputs (fill in, or ask before starting)
- Role: issuer, verifier, or both. For a verifier, which issuers and which kinds of token (access token, ID token, logout token, custom).
- Protection: signed only, or also encrypted.
- Target version: JOSE RFCs (current, the default: RFC 7515 to RFC 7519, RFC 8725, RFC 9864 and RFC 9964). Two previews, both posture build, are applied on top because they only add stricter checks: rfc8725bis (
draft-ietf-oauth-rfc8725bis-10) and Deprecate none and RSA1_5 (draft-ietf-jose-deprecate-none-rsa15-06). HPKE for JWE (draft-ietf-jose-hpke-encrypt-22, posture build) is used only when the deployment opts in. PQ/T composite signatures (draft-ietf-jose-pq-composite-sigs-04) and JSON Web Proof (draft-ietf-jose-json-web-proof-14) are posture track: recognise them, never issue them in production. Cite drafts by draft name, never as RFCs. Seereferences/versions.md. - Revision: the pinned revisions in Sources, unless the user names another. Drafts apply only at the posture recorded there.
- Sources: when refreshing this skill or when a rule looks out of date, re-read every URL in Sources first, check the IETF datatracker for a published RFC 8725 successor, a published deprecation of
noneandRSA1_5, and new revisions or RFCs of the HPKE, composite signature and JSON Web Proof drafts, re-read both IANA registries, and update the pins.
Invariants
- Algorithms come from an allow-list, never from the token. Allow only algorithms chosen for this issuer and this kind of token, compared case-sensitively (RFC 8725 § 3.1; draft-ietf-oauth-rfc8725bis-10 § 3.1).
noneis never accepted by default (RFC 7518 § 3.6).noneandRSA1_5are disabled by default and enabled, if ever, only per object (draft-ietf-jose-deprecate-none-rsa15-06 § 5).- One key, one algorithm. The header
algMUST be consistent with the key found bykid(RFC 8725 § 3.1; rfc8725bis § 3.1). This blocks the RS256-to-HS256 key confusion attack. - The verification key belongs to the issuer named in
iss, or the token is rejected (RFC 8725 § 3.8). audnames the recipient whenever the issuer serves more than one audience; otherwise reject (RFC 7519 § 4.1.3; RFC 8725 § 3.9).expandnbfare enforced, with only a small leeway for clock skew (RFC 7519 § 4.1.4, § 4.1.5).- Each kind of JWT has its own explicit
typand validation rules that reject the other kinds (RFC 8725 § 3.11, § 3.12). Access tokens useat+jwt(RFC 9068 § 2.1). - An unknown
critextension makes the token invalid (RFC 7515 § 4.1.11). kid,jkuandx5uare attacker input. Sanitizekid; never fetchjkuorx5uoutside an allow-list (rfc8725bis § 3.10).- Every layer of a nested JWT is validated (RFC 8725 § 3.3).
- Keys are strong enough. HMAC keys are at least the hash size (RFC 7518 § 3.2) and never passwords (RFC 8725 § 3.5); RSA keys are at least 2048 bits (RFC 7518 § 3.3).
- New deployments use fully specified algorithms, such as
Ed25519rather than the deprecatedEdDSA(RFC 9864 § 2.2, § 4.1.2; rfc8725bis § 3.2). - An
AKPkey is bound to itsalg.algis required on every AKP key,privnever appears in a public key, and an ML-DSAprivis the 32-byte seed (RFC 9964 § 3, § 4).
Workflow
- Pick the version, then list issuers and token kinds. Target the JOSE RFCs with the rfc8725bis and deprecation previews; add HPKE for JWE only where both sides opt in. For each issuer, write down the issuer identifier, the key source, the expected
typ, the audience and the allowed algorithms. -> references/versions.md ✓ The rules in use name their RFC or draft revision, and no verifier accepts "any algorithm the key supports" or "any issuer". - Choose algorithms and keys. Prefer
ES256orEd25519; use HMAC only with a shared secret of at least the hash size. ChooseML-DSA-44,ML-DSA-65orML-DSA-87(RFC 9964) when signatures must resist a quantum attacker and every verifier supports them. -> references/algorithms-and-keys.md ✓ Every key has exactly onealg, andnone,RSA1_5,EdDSAand draft composite identifiers are not on any new allow-list. - Publish keys as a JWK Set with
kid,alganduseon each key. Distinctkidvalues let verifiers pick the right key during rollover (RFC 7517 § 4.5). -> references/algorithms-and-keys.md ✓ The JWK Set has no private members (d,p,q) and no duplicatekid. - Issue tokens with an explicit
typ, the claims the profile requires, a shortexpand a distinctaudper recipient. -> references/access-tokens.md ✓ An access token carriestyp: at+jwtandiss,exp,aud,sub,client_id,iatandjti. - Verify tokens by running the checklist: format, header, key lookup, cryptography, claims.
-> references/verification.md
✓ Tokens with
alg: none, an HS256 signature made with the RSA public key, a wrongtyp, a wrongaudor a pastexpare each rejected. - Add encryption only when needed, with OAEP or ECDH-ES (or HPKE when both sides opt in), no compression unless required, and limits on PBES2 iterations and decompressed size.
-> references/algorithms-and-keys.md
✓ A JWE with
RSA1_5, or with ap2cabove the limit, is rejected, and JWS and JWE are not told apart by the presence ofenc. - Name claims from the registry. Reuse registered claims; give new ones a collision-resistant name. -> references/access-tokens.md ✓ Every custom claim is either registered with IANA or a name you control.
- Upgrade (only when asked). Bring an RFC 8725 verifier up to rfc8725bis, apply the
noneandRSA1_5defaults, or moveEdDSAkeys toEd25519. -> references/versions.md ✓ The new rejection tests pass, and every token a conforming issuer sent before is still accepted.
Verify before done
- The verifier passes a fixed
algorithmslist, and that list excludesnone. -
iss,aud,exp,nbfandtypare checked for every token kind. - Keys come from configuration or the issuer's metadata, never from
jku,x5uorjwkin the token. - A test token signed with HS256 using the RSA public key as secret is rejected.
- HMAC secrets are at least as long as the hash output and RSA keys at least 2048 bits.
-
AKPkeys carryalg, published ones have nopriv, and no composite or JWP identifier is issued in production. - Access tokens use
at+jwtand the RFC 9068 § 2.2 claims; roles, groups and entitlements follow RFC 9068 § 2.2.3.1. - Every draft in use carries its pinned revision and posture.
Reference index
references/versions.md: the JOSE RFCs line, the three build-posture previews and the two tracked ones (composite signatures, JSON Web Proof), what each changes, the RFC 8725 to rfc8725bis verifier upgrade, thenoneandRSA1_5move, andEdDSAtoEd25519. Load for steps 1 and 8.references/verification.md: the step-by-step verification checklist, key confusion, claim checks and a TypeScript example withjose.references/algorithms-and-keys.md: the IANA algorithm statuses, RFC 9864, RFC 9964 ML-DSA andAKPkeys, PQ/T composite signatures, HPKE for JWE, thenoneandRSA1_5deprecation, key strength, JWE limits, JWK members, thumbprints andcnf.references/access-tokens.md: the RFC 9068 access token profile, roles, groups and entitlements, its validation steps, and the IANA claims registry.
Related skills
oauthfor how access tokens are obtained, presented, bound with DPoP or mTLS, and challenged:npx skills add ScaleDockHQ/scaledock-skills --skill oauthopenid-connectfor ID tokens and their validation:npx skills add ScaleDockHQ/scaledock-skills --skill openid-connectsd-jwtfor selective disclosure on top of JWS:npx skills add ScaleDockHQ/scaledock-skills --skill sd-jwthttp-message-signaturesfor signing HTTP requests and responses instead of tokens:npx skills add ScaleDockHQ/scaledock-skills --skill http-message-signatureswimsefor workload identity tokens between services:npx skills add ScaleDockHQ/scaledock-skills --skill wimsecose, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill cosecbor, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill cborweb-cryptography, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill web-cryptography
Sources
Status uses the publishing body's own maturity term. Checked is the date the source was last read.
- RFC 7515: JSON Web Signature (JWS): RFC (Proposed Standard), RFC 7515, checked 2026-10-02.
- RFC 7516: JSON Web Encryption (JWE): RFC (Proposed Standard), RFC 7516, checked 2026-10-02.
- RFC 7517: JSON Web Key (JWK): RFC (Proposed Standard), RFC 7517, checked 2026-10-02.
- RFC 7518: JSON Web Algorithms (JWA): RFC (Proposed Standard, updated by RFC 9864), RFC 7518, checked 2026-10-02.
- RFC 7519: JSON Web Token (JWT): RFC (Proposed Standard, updated by RFC 7797 and RFC 8725), RFC 7519, checked 2026-10-02.
- RFC 8037: CFRG Elliptic Curve Diffie-Hellman (ECDH) and Signatures in JOSE: RFC (Proposed Standard, updated by RFC 9864), RFC 8037, checked 2026-10-02.
- RFC 8725: JSON Web Token Best Current Practices: RFC (Best Current Practice), RFC 8725, checked 2026-10-02.
- JSON Web Token Best Current Practices (rfc8725bis): RFC Editor queue, draft-ietf-oauth-rfc8725bis-10 (2026-08-31; intended Best Current Practice, obsoletes RFC 8725; RFC Editor state Blocked, reference not received), checked 2026-10-05. Draft posture: build, pinned to -10.
- RFC 9864: Fully-Specified Algorithms for JOSE and COSE: RFC (Proposed Standard), RFC 9864, checked 2026-10-02.
- JOSE: Deprecate 'none' and 'RSA1_5': WG draft, draft-ietf-jose-deprecate-none-rsa15-06 (2026-09-25; in IETF Last Call, intended Proposed Standard), checked 2026-10-05. Draft posture: build, pinned to -06.
- RFC 9964: ML-DSA for JSON Object Signing and Encryption (JOSE) and CBOR Object Signing and Encryption (COSE): RFC (Proposed Standard), RFC 9964 (May 2026), checked 2026-10-05.
- Use of Hybrid Public Key Encryption (HPKE) with JSON Web Encryption (JWE): RFC Editor queue, draft-ietf-jose-hpke-encrypt-22 (2026-07-06; intended Proposed Standard, updates RFC 7516; RFC Editor state Blocked; alg values registered by IANA 2026-09-29), checked 2026-10-05. Draft posture: build, pinned to -22.
- PQ/T Hybrid Composite Signatures for JOSE and COSE: WG draft, draft-ietf-jose-pq-composite-sigs-04 (2026-09-10; intended Proposed Standard), checked 2026-10-05. Draft posture: track, pinned to -04.
- JSON Web Proof: WG draft, draft-ietf-jose-json-web-proof-14 (2026-07-20; intended Proposed Standard), checked 2026-10-05. Draft posture: track, pinned to -14.
- RFC 9068: JWT Profile for OAuth 2.0 Access Tokens: RFC (Proposed Standard), RFC 9068, checked 2026-10-02.
- RFC 7643: SCIM Core Schema: RFC (Proposed Standard, updated by RFC 9865 and RFC 9967), RFC 7643, checked 2026-10-02.
- RFC 7638: JSON Web Key (JWK) Thumbprint: RFC (Proposed Standard), RFC 7638, checked 2026-10-02.
- RFC 7800: Proof-of-Possession Key Semantics for JWTs: RFC (Proposed Standard), RFC 7800, checked 2026-10-02.
- RFC 9449: OAuth 2.0 Demonstrating Proof of Possession (DPoP): RFC (Proposed Standard), RFC 9449, checked 2026-10-02.
- RFC 8705: OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens: RFC (Proposed Standard), RFC 8705, checked 2026-10-02.
- RFC 8414: OAuth 2.0 Authorization Server Metadata: RFC (Proposed Standard), RFC 8414, checked 2026-10-02.
- RFC 6750: OAuth 2.0 Bearer Token Usage: RFC (Proposed Standard, updated by RFC 8996 and RFC 9700), RFC 6750, checked 2026-10-02.
- IANA JSON Object Signing and Encryption (JOSE) registries: IANA registry, last updated 2026-09-29, checked 2026-10-05.
- IANA JSON Web Token (JWT) registries: IANA registry, last updated 2026-07-20, checked 2026-10-02.