Skip to content

Verify the id_token nonce#70

Merged
kpfleming merged 2 commits intomainfrom
fdenis/noncecheck
May 4, 2026
Merged

Verify the id_token nonce#70
kpfleming merged 2 commits intomainfrom
fdenis/noncecheck

Conversation

@jedisct1
Copy link
Copy Markdown
Collaborator

The code generates a fresh nonce for each authorize request, embeds it in the locally-signed state JWT, and forwards it to the identity provider. Great!

But what it never did was check that the id_token coming back from the token endpoint actually echoed the same value, effectively making the nonce useless.

Skipping that step leaves room for id_token substitution. Any valid id_token for the same client identifier (a stale one, from another application, or one swapped by a hostile proxy) would be accepted.

Verifying the nonce that was sent is also required by the OpenID Connect Core specification.

So, validate the id_token's nonce against the value that was originally sent.
This is a built-in feature of the underlying JWT library.

The code generates a fresh nonce for each authorize request,
embeds it in the locally-signed state JWT, and forwards it to the
identity provider. Great!

But what it never did was check that the id_token coming back from
the token endpoint actually echoed the same value, effectively
making the nonce useless.

Skipping that step leaves room for id_token substitution.
Any valid id_token for the same client identifier (a stale one,
from another application, or one swapped by a hostile proxy) would
be accepted.

Verifying the nonce that was sent is also required by the OpenID
Connect Core specification.

So, validate the id_token's nonce against the value that was
originally sent. This is a built-in feature of the underlying JWT
library.
@jedisct1 jedisct1 requested a review from a team as a code owner April 27, 2026 15:58
@jedisct1 jedisct1 requested review from kailan and removed request for a team April 27, 2026 15:58
@kpfleming kpfleming removed the request for review from kailan May 4, 2026 13:28
@kpfleming
Copy link
Copy Markdown
Member

A rebuild succeeded, because a new version of ml-dsa had been published. It's a bit concerning that the ml-dsa crate (and its sibling crates) are being published to crates.io as 'RC' but not marked as pre-release versions.

@kpfleming kpfleming merged commit 526f011 into main May 4, 2026
3 of 4 checks passed
@kpfleming kpfleming deleted the fdenis/noncecheck branch May 4, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants