Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ndi): fix missing kid on JWS header #608

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

cflee
Copy link
Contributor

@cflee cflee commented Oct 9, 2023

Problem

After refactor of the NDI implementation to use jose library in #595, kid is no longer being set on the ID token JWS header. This is breaking verification of the ID token JWS, as RPs need to select the appropriate key from the OP JWKS based on the kid value for verification.

Accessing signingKey.kid doesn't work as signingKey is from jose.importJWK(), which is a generic crypto library KeyObject that isn't aware of JWK and so doesn't have the concept of the kid. In the implementation prior to refactor the signingKey appears to be some kind of JWK-aware thing so it had the kid.

Closes #604

Solution

Bug Fixes:

  • When constructing the ID token JWS, populate the kid header value from the original pre-parsing-into-KeyObject JSON object.

Copy link
Collaborator

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

lgtm

@LoneRifle LoneRifle merged commit 63aecf7 into opengovsg:master Oct 11, 2023
2 checks passed
@cflee cflee deleted the missing-kid branch October 11, 2023 12:34
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.

Missing kid field in jws header
2 participants