Changelog - 2026-11-07
JWT verification requires an issuer and an audience
Security Breaking ChangeIn one line. Bearer and JWKS verification checked only the signature and the expiry, so a token signed with the same key for another purpose (a password-reset or invite token that carries a user id) authenticated a request. Every JWT configuration now needs claims: { issuer, audience }, and a configuration without it does not boot.
NOTE
claims.audience is optional: see The token audience is optional. claims.issuer stays required.
What changed
claimsis required.claims.issuerandclaims.audience(a string, or a list foraudience) are stamped on every token IGNIS signs and required on every token it verifies. A token without them, or with other values, is refused with401.- Strict.
claimsaccepts these two keys only. A misspelt key (audiance) refuses the boot, and the message names it. A missing or emptyissueroraudiencerefuses the boot, naming the key. - The algorithm is pinned. A JWS service accepts
headerAlgorithm(HS256by default) only, and a JWKS issuer accepts itsalgorithmonly. A token signedHS512with the same secret is refused.verify.algorithmswidens the pin by an explicit choice. - A JWKS verifier requires
verify.algorithms. It cannot know what the issuer signs with, so a verifier withoutverify.algorithmsdoes not boot. - One home for the two values.
issuerandaudiencemoved out ofverify, and thesignoption is gone. A configuration that still passes them is refused at boot with a message that points toclaims. The otherverifyoptions (subject,clockTolerance,maxTokenAge,typ,requiredClaims) stay. - Per-token claims.
generate({ claims })still sets a per-tokenaudience,issuer,subjectorjwtId, and wins over the configured ones. The payload never does. - Service assertions are unchanged. They already stamp their
nameasissand demand it asaud.
Who is affected
- Every application that configures
JWT_OPTIONS. Addclaims, and for a JWKS verifierverify.algorithms. The application does not boot without them. - Tokens issued before the upgrade. They carry no
issand noaud, so they are refused: users sign in again. There is no switch to accept them. - A fleet. Give every verifier the
issuerandaudienceits issuer stamps. A token minted for another service by anotheraudienceis refused by design. - Supabase or another provider. Use the values its tokens carry: Supabase Auth writes
https://<project>.supabase.co/auth/v1andauthenticated.
Breaking changes
WARNING
An application whose JWT options have no claims does not boot, and every token issued before the upgrade is refused.
Before:
typescript
// JWS
this.bind<TJWTTokenServiceOptions>({ key: AuthenticateBindingKeys.JWT_OPTIONS }).toValue({
standard: JOSEStandards.JWS,
options: {
jwtSecret: process.env.APP_ENV_JWT_SECRET!,
getTokenExpiresFn: () => 86400,
sign: { issuer: 'my-api', audience: 'my-api' }, // optional
verify: { issuer: 'my-api', audience: 'my-api' }, // optional
},
});
// JWKS verifier
options: { mode: JWKSModes.VERIFIER, jwksUrl: 'https://auth.example.com/certs' }After:
typescript
// JWS
this.bind<TJWTTokenServiceOptions>({ key: AuthenticateBindingKeys.JWT_OPTIONS }).toValue({
standard: JOSEStandards.JWS,
options: {
jwtSecret: process.env.APP_ENV_JWT_SECRET!,
getTokenExpiresFn: () => 86400,
claims: { issuer: 'my-api', audience: 'my-api' }, // required
},
});
// JWKS issuer
options: { mode: JWKSModes.ISSUER, /* algorithm, keys, kid, getTokenExpiresFn */ claims: { issuer: 'https://auth.example.com', audience: 'my-api' } }
// JWKS verifier: the issuer and audience the issuer stamps, and the algorithm it signs with
options: {
mode: JWKSModes.VERIFIER,
jwksUrl: 'https://auth.example.com/certs',
claims: { issuer: 'https://auth.example.com', audience: 'my-api' },
verify: { algorithms: ['ES256'] },
}Upgrade steps:
- Choose an
issuerand anaudienceper service. The issuer name is what identifies who signed; the audience is who the token is for. - Replace
sign: { issuer, audience }andverify: { issuer, audience }withclaims, and addverify.algorithmsto each JWKS verifier. - Deploy. Users with an older token sign in again.
Details
| File | Package |
|---|---|
src/base/auth/authenticate/common/types/jwt.ts | kernel |
src/components/auth/authenticate/component.ts | core |
src/components/auth/authenticate/services/bearer/abstract.service.ts | core |
src/components/auth/authenticate/services/bearer/jws.service.ts | core |
src/components/auth/authenticate/services/bearer/jwks/issuer.service.ts | core |
src/components/auth/authenticate/services/bearer/jwks/verifier.service.ts | core |