Complete Mediation
What you'll learn: How to ensure every single access request is validated, never skipping or caching authorization decisions.
The Core Principle
Complete mediation means every access to every resource must be checked every time—no shortcuts, no assumptions, no caching of authorization decisions. Think of it like airport security: even if you flew yesterday and were cleared, you still go through screening today. The system never says "I checked you last time, so you're fine now."
This principle prevents attackers from exploiting stale permissions, bypassing checks after an initial success, or manipulating cached authorization states.
Why Complete Mediation Matters
Many vulnerabilities arise when systems:
- Cache an authorization decision and reuse it after permissions change
- Skip checks on subsequent requests in a session
- Assume "if they got this far, they must be authorized"
- Perform security checks only at entry points, not at data access layers
Real-world analogy: Imagine a library that checks your membership card once when you enter, then lets you access any restricted archive without further checks. If your membership expires mid-visit or gets revoked, you'd still have access. Complete mediation means checking your card every time you access a restricted section.
Implementation Considerations
Every API call, database query, file access, and resource request must validate:
- Authentication: Is the user who they claim to be right now?
- Authorization: Does this user currently have permission for this specific resource?
- Context: Has anything changed since the last check (roles, policies, resource ownership)?
Never trust that previous checks are still valid. Session tokens should be validated on every request, database access should enforce row-level security, and file operations must verify permissions at access time.
Key Takeaway: Complete mediation requires validating authorization at every access point without exception—never cache security decisions or bypass checks based on prior success.