Privilege Change Session Hygiene
Verify role, tenant and scope changes invalidate or reissue sessions, so stale credentials never outlive the privilege they once expressed
Use when: administrators demote, suspend or change accounts' roles and the system promises control over materialized privileges
Avoid when: no privilege changes exist beyond initial account creation and rotation, in which case the change surface is empty
Procedure
- Create or select test identities whose roles you control and capture full sessions before any change.
- Record the pre-change session material: cookie, bearer token, refresh chain and any derived view of the identity.
- Apply the change, then call a representative operation set with both old and new session material.
- Include read and write operations from the old role scope so success contradicts the admin's intent briefly and provably.
- Watch caches, webhook registrations and background jobs, which may retain the pre-change authorization state.
- Repeat for each change type the product supports, recording which session material survives each.
Signals
- After a demotion, the old session performs an operation the new role could never reach.
- A suspended account continues producing responses that should have been impossible given its suspension state.
- Refresh rotation accepts a token issued before the privilege change and mint new credentials with the old role.
- Caches keyed purely by identity honor the change less strictly than the session examined directly.
Patterns
1. Change replay
status: member -> suspended -> old session, next call: 200 -> session kept on change
2. Refresh chain
refresh token from t0 still valid after demotion -> old-role inheritance via refresh
3. Result row
change=demote session_state=live cache_state=stale refreshed_role=member-window 3m
Pitfalls
- Testing the change only on the operation a UI calls, while a very similar operation lacks invalidation.
- Concluding expiry is a sufficient fix, since a session that expires tomorrow may still honor the new role today.
- Forgetting cache and background layers where session and request-time authorization drift apart.
Done when
- Every role or status change type has been tested per session material with an exemplar operation before and after.
- Whether invalidation propagates to caches, refresh tokens, webhooks and background jobs is recorded per change type.