Skip to content

fix: use up-to-date kid in JWT header when refreshing#3973

Open
tilgovi wants to merge 2 commits into
ory:masterfrom
tilgovi:refresh-kid
Open

fix: use up-to-date kid in JWT header when refreshing#3973
tilgovi wants to merge 2 commits into
ory:masterfrom
tilgovi:refresh-kid

Conversation

@tilgovi

@tilgovi tilgovi commented Apr 5, 2025

Copy link
Copy Markdown

This PR is a variation on #3942 that attempts to solve the problem by letting fosite set the kid header of tokens and removing all of the code to explicitly set this header in JWTs.

@tilgovi tilgovi requested review from a team and aeneasr as code owners April 5, 2025 19:27
@tilgovi tilgovi force-pushed the refresh-kid branch 4 times, most recently from 576225f to ed11711 Compare April 5, 2025 21:09
@tilgovi

tilgovi commented Apr 7, 2025

Copy link
Copy Markdown
Author

Not sure if there's anything I should do about the CodeQL scanning results task failing. It seems spurious.

@aeneasr aeneasr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you and good approach, some ideas to improve it further. I accepted the CodeQL issues

"extra": {
}
},
"headers": null,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please keep the headers.extra keys, as changing them to null will potentially break webhook receivers.

rotateJwks("hydra.jwt.access-token")
rotateJwks("hydra.openid.id-token")

cy.refreshTokenBrowser(client, tokensBefore.refresh_token).then(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test isn't actually checking that the kid is set correctly, it only validates its non-equality. Can you please make sure that the kid is set correctly - either with a regex (expect a non-nil uuid) or some other way?

From the snapshots it looks like it was public:hydra.jwt.access-token before. What is the value now?

@tilgovi

tilgovi commented Apr 17, 2025

Copy link
Copy Markdown
Author

I pushed up three commits to restore the extra key, validate the UUID format, and remove some of the extraneous diff.

@tilgovi

tilgovi commented Apr 17, 2025

Copy link
Copy Markdown
Author

Also, please let me know how you'd like me to resolve conflicts, if at all. I can merge or rebase or squash at your preference.

Co-authored-by: Randall Leeds <randall.leeds@nytimes.com>
@tilgovi

tilgovi commented Apr 17, 2025

Copy link
Copy Markdown
Author

I realized the checks wouldn't even run due to the conflict, so I rebased and squashed.

@tilgovi

tilgovi commented Apr 18, 2025

Copy link
Copy Markdown
Author

And, I think the CI jobs flaked, but I can't re-run them. 😞

@tilgovi

tilgovi commented May 1, 2025

Copy link
Copy Markdown
Author

@aeneasr anything more I can do here?

@permfl

permfl commented Sep 22, 2025

Copy link
Copy Markdown

@aeneasr is it possible to get this change merged?

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.

6 participants