[OLH-1727] Add logging and testing for session state during authentication flow#2718
Open
jeremy-barrass-gov wants to merge 5 commits intomainfrom
Conversation
liegeandlief
approved these changes
Jan 28, 2026
TaherKapasi
requested changes
Jan 28, 2026
| }, | ||
| } | ||
| ); | ||
| logger.info( |
Contributor
There was a problem hiding this comment.
could we make this a debug line please
| queryParams: CallbackParamsType, | ||
| clientAssertion: string | ||
| ) { | ||
| logger.info( |
Contributor
There was a problem hiding this comment.
could we make this a debug line please
| { trace: req.res?.locals.trace }, | ||
| `Generated token session state: ${tokenSet.session_state}` | ||
| ); | ||
| if (tokenSet.session_state !== req.session.state) { |
Contributor
There was a problem hiding this comment.
I would like handleOidcCallbackError, when receiving the state in the qsp - I want this to exactly match the one held in the session otherwise redirect to PATH_DATA.SESSION_EXPIRED.url with a warning error stating that the state did not match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
OLH-1727 Add logging, testing and error handling to authentication flow to confirm state has not been changed between the Authentication Request and Response
What changed
Added logging of the state session state on the request and the generated token, added a check for value mismatch and subsequent error handling, added a unit test to confirm any change to this state following the OICD Callback is detected.
Why did it change
Because 302 access_denied (Invalid state param present in Authorisation response) errors had been reported.
Related links
https://govukverify.atlassian.net/browse/OLH-1727?atlOrigin=eyJpIjoiODgzNTMxZGY3M2FkNGY4NWFlZDZlMzNmMzA5YTAzM2YiLCJwIjoiaiJ9
Checklists
Environment variables or secrets
Testing
Run unit tests. All tests pass.
Sign-offs
Monitoring
How to review