github sebadob/rauthy v0.38.1

one hour ago

Changes

PQC JWT Token Signatures - FIPS 204 / RFC 9964

I neither think it is necessary, nor do I recommend using PQC token signature yet. Tokens become massive with it, and only few clients even support them. However, since I created the FIPS 204 issue more than a year ago, a lot has changed, and we at least now have the first stable RFC for ML-DSA signatures. I would not use them at all yet, but it's good to have them available.

Since this is a patch release, they are opt-in. Once you do this, even though Rauthy usually guarantees downgrade compatibility between patch levels, it will not make it possible to downgrade to an earlier version.

You can now sign tokens with ML-DSA-44 or ML-DSA-65. The ML-DSA-87 version was left out on purpose. The signatures for the PQC variants are massive, and they heavily blow up the JWKS response as well as JWT tokens. The 87 variant is not necessary at all, and a single signature from it would be bigger than all other current JWKS certs together. ML-DSA-44 is the one to use if you want to migrate. It provides a security comparable to EdDSA or RS384.

You get a new config var for opt-in:

[access]
# Generates ML-DSA (FIPS 204) signing keys during bootstrap and key
# rotation, and publishes them on the `/oidc/certs` endpoint as `AKP`
# keys with the `ML-DSA-44` and `ML-DSA-65` algorithms.
#
# The default is `false`, because strict JWKS parsers of existing
# clients may reject the new `kty`, and the tokens are considerably
# bigger. This will become `true` with a future major release.
#
# With `false` no `ML-DSA` key is ever written, which is what makes an
# upgrade from an older release change nothing. A running deployment
# enables it by setting this to `true` and rotating its keys, which the
# `JWKs` page of the Admin UI does immediately.
#
# Rauthy usually guarantees a downgrade to any earlier release, and
# this is the one case that breaks it: releases up to `v0.38.0` cannot
# read an `ML-DSA` row in the `jwks` table and answer `/oidc/certs`
# with a `500`. With `[[cluster]]` that means: enable it only when
# every node runs a newer release than `v0.38.0`, never during a
# rolling upgrade. And once the keys exist, a downgrade is not
# possible by disabling this again: the key cleanup always keeps the
# newest key of every algorithm, so at least one `ML-DSA` row stays in
# the table, and an older release needs those rows deleted in the DB.
#
# Clients that were set to `ML-DSA` while it was on keep signing with
# the key set in the `jwks` table after it is disabled again. Rauthy
# stops rotating that set and names every such client in its startup
# log.
#
# Clients that cannot handle `AKP` keys can skip them per request with
# `GET /oidc/certs?skip_akp=true`.
#
# default: false
# overwritten by: PQC_SIGNATURES_ENABLED
pqc_signatures_enabled = false

If you enable it, you also must trigger a JWKS Rotation via the Admin UI to actually generate the certificates. Once you did this, you will not be able to downgrade to any prior version, incl v0.38.0!

If you have issues with some clients that break because of the unknown alg on the JWKS endpoint (they shouldn't, the RFC says "ignore unknown algs", but quite a few do), you can set a new query param for the lookup: skip_akp=true.

The rauthy-client-0.15 is not compatible with them either. If you use it, you must upgrade to v0.16 beforehand.

#2053

Refresh Token nbf - Early Refreshes

A refresh_token is not valid before its nbf, and every usage before it invalidates the refresh token itself, the access_token issued with it, and the session it belongs to - nothing else of the user - because a token that early in the game may be a leaked one. The nbf rule is enforced by the JWT validation like every other claim, and an early usage is reported as a dedicated
JwtTokenNotValidYet error type that triggers that invalidation. Until now, that nbf was access_token.exp - 60 seconds, which is exactly what Rauthy's own client does, and nothing else. A lot of other ones refresh way earlier, the common JS libraries at 120 s before expiry and the Angular OAuth client at 75 % of the window, and those used to crash their own session on the first
refresh.

The nbf is now the earlier of both access_token.exp - 150 seconds and iat + 70 % of the access_token's lifetime. The duration covers the fixed-margin refresher, the percentage covers the ones that refresh at a fraction of the window, and the percentage is the rule that wins from an access_token_lifetime of 500 s on. For the bootstrap clients with their 900 s tokens, the refresh token became valid at 840 s and becomes valid at 630 s now.

Both are new config vars in [lifetimes], and access.disable_refresh_token_nbf still disables the claim completely:

[lifetimes]
# How far before the linked `access_token`'s `exp` the `refresh_token`
# becomes valid. This is the rule for clients that refresh a fixed time
# before expiry, and 150 s accepts the common JS clients that refresh
# 120 s early. Below an `access_token_lifetime` of 500 s this is the
# rule that wins, and below 150 s the `nbf` ends up before the token's
# own `iat`, which makes the `refresh_token` valid at issuance.
#
# type: duration
# default: '150s'
# overwritten by: REFRESH_NBF_SKEW_DURATION
refresh_nbf_skew_duration = '150s'

# How much of the linked `access_token`'s lifetime must have passed,
# counted from its `iat`, before the `refresh_token` becomes valid.
# This is the rule for clients that refresh at a fraction of the
# window, like the Angular OAuth client at 75 %. It is the one that
# wins from a client's `access_token_lifetime` of 500 s on, and it has
# to stay above 0: an `nbf` at the token's own `iat` would make the
# `refresh_token` valid at issuance and drop the early usage detection
# completely.
#
# default: 70
# overwritten by: REFRESH_NBF_SKEW_PERCENT
refresh_nbf_skew_percent = 70

A lifetime below 150 s moves the nbf to before the token's own issuance, which makes the refresh_token valid the moment it was issued. That is what a client with such a lifetime does anyway, so nothing is protected there, and the Admin UI shows a warning for a client with a token lifetime below 150 s and the refresh_token flow enabled.

The exp of a refresh_token runs from the access_token's exp now, never from its nbf, so the configured lifetime always lands after the nbf and the validity window stays valid for any configuration. The device rows in the devices table follow the tokens they are issued for.

#2054

Deny E-Mail change for Federated Users

Federated users' values are always synced from upstream after each login. If a user changes the email on Rauthy, and it differs from upstream, this would reset the email with the next login. This is intentional. However, it's possible that this can produce very unexpected account conflicts. For this reason, you cannot change the email for federated users anymore.

#2057

Bugfix

  • It was possible to trigger a panic depending on the configured http worker count when using upstream auth providers.
    #2039
  • The access.session_validate_ip = false setting was not fully respected during forward auth.
    #2039
  • Fixed config parsing for dynamic_clients.reg_token (DYN_CLIENT_REG_TOKEN).
    #2041
  • Fixed Event::scim_task_failed emitting BackchannelLogoutFailed instead of ScimTaskFailed.
    #2044
  • Fixed user picture uploads deleting the existing picture before validating the new upload and panicking on invalid storage during download.
    #2049
  • Fixed refresh-token rejections returning a non-standard error code instead of RFC 6749 invalid_grant.
    #2052
  • Fixed authorization code rejections returning a non-standard error code instead of RFC 6749 invalid_grant.
    #2056
  • I introduced a change when setting email_verified in tokens with v0.38.0 because of a misdiagnosis of an issue. 0.38.0 sets it unconditionally, and it was now reverted back to the correct behavior - set the claim only when the email scope was either requested or is a default scope.
    #2058

Don't miss a new rauthy release

NewReleases is sending notifications on new releases.