Course contentsShow
← Security
Lesson 2666 of 3,05250. Secure Architecture and DesignFree lesson

Fail-Safe Defaults

Default to denying access; require explicit grants rather than explicit denials for secure default behavior.

Fail-Safe Defaults

What you'll learn: How defaulting to deny ensures systems remain secure even when explicit permissions aren't configured.

The Core Principle

Fail-Safe Defaults means your system should start in the most restrictive, secure state possible—denying all access by default. Access should only be granted through explicit, intentional configuration. Rather than blocking what you remember to forbid, you allow only what you deliberately permit.

Think of it like a bank vault: the door is locked by default, and only specific people with keys can enter. You don't start with an open vault and try to remember to lock it or keep out unauthorized people—that's backwards and dangerous.

Why It Matters

When systems fail-safe, configuration errors, oversights, or component failures automatically result in denial rather than accidental exposure. A misconfigured firewall rule? Traffic is blocked. A missing authorization check? Access denied. An uninitialized permission flag? No access granted.

This contrasts with fail-open approaches where absence of rules means "allow"—a recipe for security disasters when mistakes happen (and they always do).

Secure Default Behavior in Practice

  • Firewall rules: Block all traffic by default; explicitly allow specific ports/protocols
  • User accounts: New users have zero permissions until roles are assigned
  • API endpoints: Require authentication on all routes unless explicitly marked public
  • File permissions: Files created with restrictive permissions, broadened only when needed
  • Configuration flags: Security features enabled by default, requiring explicit opt-out

This complements Least Privilege (grant minimal necessary access) and Complete Mediation (check every access attempt) by establishing the baseline: nothing is permitted until proven authorized.

Key Takeaway: Fail-safe defaults protect you from your own mistakes and system failures by making "deny" the default answer—security through safe initial states rather than perfect configuration.