VIA-942: Enforce Session Expiry Reliably After 10 Minutes of Inactivity#708
Open
liming-cheung-nhs wants to merge 4 commits intomainfrom
Open
VIA-942: Enforce Session Expiry Reliably After 10 Minutes of Inactivity#708liming-cheung-nhs wants to merge 4 commits intomainfrom
liming-cheung-nhs wants to merge 4 commits intomainfrom
Conversation
… recently called Precommit hooks bypassed; this is a work in progress commit WIP commit: contains * A Server Action to set the flag cookie * Calling the server action from the user-logout method * cherck the flag in getToken Issue under investigation 1. getToken will return null, but the MyVaccines app then currently tries to redirect the user to NHS App because they are not authenticated, meaning the user will never see the logout / session timeout screens. (at present this throws a cors error in the browser and the user never actually gets to NHS app but this is a quirk and the underlying issue still needs fixing; the user shouldnt be redirected at all for this part of the journey. The network tab shows the cors error and an error would be logged in our service logs).
|
|
||
| const mockSessionId = "session-id-123"; | ||
| const setCookie = jest.fn(); | ||
| jest.mock("sanitize-data", () => ({ sanitize: jest.fn() })); |
Contributor
Author
There was a problem hiding this comment.
This mock is required because our current Jest setup does not transpile the sanitize-data ESM package in tests, so replacing it with a stub avoids the module parse error and lets the tests run.
| }; | ||
|
|
||
| const setSignOutFlagCookieAction = async () => { | ||
| const SIGN_OUT_FLAG_COOKIE_MAX_AGE_SECONDS = 30; |
Contributor
Author
There was a problem hiding this comment.
I've set it as 30s based on comments in the commit.
I wonder if we should have it higher as the session refresh is every 60s (see ClientProviders.tsx).
If we get a refresh, then a logout within next 30s, then the next refresh in 60s would not see the cookie as it has expired? 🤔
Co-authored-by: Copilot <copilot@github.com>
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.
Description
Testing on deployed to sandpit personal workspace
Note: Existing issue under investigation:
getTokenwill return null, but the MyVaccines app then currently tries to redirect the user to NHS App because they are not authenticated, meaning the user will never see the logout / session timeout screens. (at present this throws a cors error in the browser and the user never actually gets to NHS app but this is a quirk and the underlying issue still needs fixing; the user shouldnt be redirected at all for this part of the journey. The network tab shows the cors error and an error would be logged in our service logs).Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.