24 - Browser Security
Overview
Architecture Diagram
┌──────────────────────────────────────────────────────────────────────────────┐
│ Browser Security Architecture │
└──────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ Security Layers │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Layer 1: Session Security │ │
│ │ - Session-based authentication │ │
│ │ - Auto-expiry at 3 AM IST (configurable) │ │
│ │ - Token revocation on logout │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Layer 2: Cookie Security │ │
│ │ - Secure flag (HTTPS only) │ │
│ │ - HttpOnly flag (no JS access) │ │
│ │ - SameSite=Lax (CSRF protection) │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Layer 3: Authentication Flow │ │
│ │ - Argon2 password hashing │ │
│ │ - TOTP support for 2FA │ │
│ │ - Rate limiting on login │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘Session Management
Session Lifecycle
Session Expiry Configuration
Session Validation
Cookie Security
Secure Cookie Settings
Cookie Flags Explained
Flag
Purpose
Password Security
Argon2 Hashing
Password Requirements
Login Rate Limiting
Configuration
Implementation
TOTP Two-Factor Authentication
Setup Flow
TOTP Validation
Token Revocation
On Logout
On Session Expiry
React Frontend Security
API Key Handling
AJAX Request Detection
Security Headers
Recommended Headers
Session Storage
What's Stored
What's NOT Stored
Credential Masking
Display Masking
Key Files Reference
File
Purpose
Last updated