Skip to main content

Security Knowledge Base

Security is not a feature you add at the end โ€” it's a property you design in from the start.


Why Security Matters for Engineersโ€‹

Security vulnerabilities are almost always caused by engineering decisions, not bad luck:

  • A parameterized query prevents SQL injection
  • An HttpOnly cookie flag prevents XSS-based session theft
  • A short JWT expiry limits the blast radius of a token leak
  • A GDPR-compliant erasure flow protects users and avoids โ‚ฌ20M fines

You don't need to be a security specialist. You need to know enough to write safe code and enough to ask the right questions in a design review.


What's Coveredโ€‹

TopicDescription
Authentication & AuthorizationSessions, JWT, OAuth 2.0, OIDC, MFA, RBAC, ABAC, passkeys
Web Vulnerabilities & DefensesOWASP Top 10 โ€” SQL injection, XSS, CSRF, SSRF, IDOR and mitigations
Cryptography & Secure DesignAES-GCM, RSA, HMAC, signatures, TLS internals, key management
Privacy & ComplianceGDPR, CCPA, PCI-DSS, HIPAA, data classification, right to erasure
Network SecurityFirewalls, WAF, DDoS, DNS security, zero trust, mTLS
Secure SDLC & DevSecOpsThreat modeling, SAST, DAST, SCA, secrets scanning, container security
Identity & Access ManagementSSO, SAML, LDAP, service accounts, Vault, JIT access, cloud IAM
API SecurityOWASP API Top 10, input validation, rate limiting, GraphQL security
Incident ResponseIR lifecycle, detection, containment, recovery, post-mortem
Interview Questions21 deep-dive answers + quick-fire reference table

Security Mental Modelโ€‹

Think of security in layers โ€” every layer can fail, so you never rely on just one.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ PERIMETER WAF ยท DDoS protection ยท Firewall โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ TRANSPORT TLS 1.3 ยท mTLS ยท Certificate mgmt โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ IDENTITY AuthN ยท MFA ยท SSO ยท Token rotation โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ APPLICATION AuthZ ยท Input validation ยท OWASP โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ DATA Encryption at rest ยท Masking ยท PII โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ AUDIT Immutable logs ยท SIEM ยท Alerting โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Attackers always find the weakest layer. Defence in depth means there is no single point of failure.


The OWASP Top 10 at a Glanceโ€‹

#RiskOne-Line Fix
A01Broken Access ControlAlways verify ownership server-side
A02Cryptographic FailuresAES-256-GCM at rest, TLS in transit
A03Injection (SQL, Command)Parameterized queries, never concatenate
A04Insecure DesignThreat model before you build
A05Security MisconfigurationDisable defaults, no verbose errors
A06Vulnerable ComponentsSCA scan in CI, auto-update patches
A07Auth FailuresMFA, short tokens, account lockout
A08Integrity FailuresNever deserialize untrusted data
A09Logging FailuresLog every auth event, no PII in logs
A10SSRFBlock private IPs, allowlist domains

Key Security Principlesโ€‹

PrincipleIn Practice
Least PrivilegeGrant only the minimum permissions needed โ€” to users, services, and DB accounts alike
Defense in DepthAssume every control can fail; never rely on a single layer
Fail SecureDefault to deny; errors should lock down, not open up
Don't Roll Your Own CryptoUse BCrypt, AES-GCM, TLS 1.3 โ€” not home-grown algorithms
Secure by DefaultSecure configuration out of the box, not opt-in
Minimize Attack SurfaceEvery unused endpoint, port, and dependency is a liability
Assume BreachDesign so that a compromised component limits blast radius
Zero TrustVerify every request โ€” network location is not a trust boundary

Common Vulnerabilities by Layerโ€‹

Code Levelโ€‹

  • SQL / NoSQL / Command injection
  • XSS (Stored, Reflected, DOM)
  • Insecure deserialization
  • Hardcoded secrets

Authentication / Sessionโ€‹

  • Weak passwords, no MFA
  • Token leakage (logging, error messages)
  • Session fixation, no logout invalidation
  • JWT alg: none acceptance

Authorizationโ€‹

  • IDOR (Insecure Direct Object Reference)
  • Privilege escalation via mass assignment
  • Missing function-level authorization
  • Overly broad IAM permissions

Infrastructureโ€‹

  • Misconfigured cloud storage (public S3 buckets)
  • Exposed admin endpoints (Actuator, Swagger)
  • Unencrypted data at rest
  • Outdated dependencies with CVEs

Learning Pathโ€‹

For Interview Preparationโ€‹

  1. Authentication & Authorization โ€” most common interview topic
  2. Web Vulnerabilities โ€” OWASP Top 10 is expected knowledge
  3. Cryptography โ€” hashing vs encryption, TLS basics
  4. Privacy & Compliance โ€” GDPR basics, PCI-DSS rules
  5. Interview Questions โ€” practise with answers

For Production Systemsโ€‹

  1. Start with Secure SDLC โ€” embed security early
  2. API Security โ€” your primary attack surface
  3. IAM โ€” get service identities right
  4. Incident Response โ€” prepare before you need it

For Compliance Projectsโ€‹

  1. Privacy & Compliance โ€” regulatory requirements
  2. Cryptography โ€” encryption obligations
  3. Audit Logging โ€” evidence trail
  4. Network Security โ€” infrastructure controls

Quick Reference: Technology Choicesโ€‹

NeedRecommended
Password hashingArgon2id (best) ยท BCrypt (standard)
Symmetric encryptionAES-256-GCM
Asymmetric encryption / signingRS256 / ES256 (JWT), RSA-OAEP (encryption)
TLSTLS 1.3 (minimum TLS 1.2)
Token formatJWT (RS256) + short TTL + refresh rotation
SSO protocol (enterprise)SAML 2.0 or OIDC
SSO protocol (consumer)OAuth 2.0 + OIDC
Secrets managementHashiCorp Vault ยท AWS Secrets Manager
SAST (Java)SpotBugs + Find Security Bugs ยท SonarQube
Dependency scanningOWASP Dependency-Check ยท Snyk
Secrets scanningGitleaks
Container scanningTrivy
DASTOWASP ZAP
WAFAWS WAF ยท Cloudflare ยท nginx ModSecurity

Interview tip

Security questions in system design interviews almost always touch one of three areas: how do you authenticate/authorize, how do you protect sensitive data, and what do you do when something goes wrong. Make sure you can answer all three confidently.

Never do this
  • Store passwords in plaintext or MD5
  • Concatenate user input into SQL queries
  • Commit secrets to version control
  • Return stack traces in API error responses
  • Trust the user_id sent by the client โ€” always derive it from the validated token