Add E2E tests for session security error pages and fix 401 response handling #830
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.



Summary & Motivation
Add end-to-end tests for two session security scenarios: session revocation detection and replay attack detection. These tests verify that users are properly redirected to context-specific error pages with appropriate messaging when their sessions are compromised.
The tests simulate real-world security scenarios:
Note: The security tests are skipped on Safari because WebKit does not allow programmatic manipulation of
__Host_prefixed cookies, which is required to simulate these attack scenarios. The tests run on Chromium and Firefox.Also remove obsolete fallback logic in
AuthenticationCookieMiddlewarethat addedSessionNotFoundheader to all 401 responses. This fallback was originally added when the backend did not consistently set thex-unauthorized-reasonheader, but is no longer needed since commit 0b7fdc2 ensures all 401 responses include the header.Checklist