Stale Session Cache Allows Revoked Access
Level 1 · node · Security · Authorization cache invalidation error
Scenario
An internal document API checks a user role through the session before allowing access to administrative documents. Access works correctly immediately after login, but operations reports show that a user can keep reading administrative documents with an existing session after an administrator changes the user role from admin to viewer. The session repository, user repository, and access service are separated.
Requirements
- Administrative documents are returned only when the user current role is admin - An existing session for a user changed to viewer must be rejected immediately with 403 - An invalid session returns 401 - Normal access remains available for users whose current role is admin - Access checks must not modify stored user data
Acceptance criteria
- A valid session for an admin user can access the administrative document
- A viewer user session is rejected with 403
- After a role changes from admin to viewer, reusing the existing session returns 403
- A nonexistent session returns 401
- The access check itself does not change stored user role data