Skip to content

Conversation

@metemaad
Copy link
Contributor

When no nonce is sent in the authorization request (nonce is nil or empty string), the id_token should not include the nonce claim. Including an empty nonce causes validation failures with some OIDC relying parties.

Per OIDC Core spec section 2, the nonce claim is optional and should only be present if a nonce was sent in the authentication request.

This fixes issues with AWS ALB OIDC authentication, which does not send a nonce parameter but validates the id_token and fails when an empty nonce claim is present.

Changes:

  • Modified maybe_put_nonce helper to skip nonce claim when nil or empty
  • Added tests for nonce handling (nil, empty string, and valid nonce)

fix for issue: #55

When no nonce is sent in the authorization request (nonce is nil or empty
string), the id_token should not include the nonce claim. Including an empty
nonce causes validation failures with some OIDC relying parties.

Per OIDC Core spec section 2, the nonce claim is optional and should only
be present if a nonce was sent in the authentication request.

This fixes issues with AWS ALB OIDC authentication, which does not send
a nonce parameter but validates the id_token and fails when an empty
nonce claim is present.

Changes:
- Modified maybe_put_nonce helper to skip nonce claim when nil or empty
- Added tests for nonce handling (nil, empty string, and valid nonce)
Copy link
Collaborator

@patatoid patatoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution, the tests are greatly welcomed

@patatoid
Copy link
Collaborator

The pipeline fails due to issues with the did service. I am on the way to fix, besides that everything look good. I still merge on master, this not being related to the changes. Notice that there may be issues with the universal keys. Keeping you posted here.

@patatoid patatoid merged commit e0e295f into malach-it:master Dec 16, 2025
2 of 4 checks passed
@metemaad
Copy link
Contributor Author

Thanks for the clarification! Good to know the DID service issue is on your radar. It appears the DID_SERVICES_API_KEY secret referenced in the CI workflow is not configured or has expired.

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