Securing a cloud-native application is fundamentally different from securing a server-room monolith. The attack surface is larger, the dependencies are deeper, the credentials are everywhere, and the perimeter is fluid. Modern application security is defense in depth at every layer.
This lesson covers the security concerns specific to cloud-native SaaS: application-level attacks, supply chain, secrets, runtime, and the zero-trust model that ties it all together.
Defense in Depth
The principle: multiple layers of independent security, so a single failure doesnβt cascade.
Each layer catches what others miss. Strong identity doesnβt help if SQL injection lets attackers bypass the app entirely. Encryption at rest doesnβt help if logs leak plaintext PII. Apply security at every level.
OWASP Top 10
The industry-standard list of most-impactful web application security risks. Worth knowing every one:
π
A01: Broken Access Control
Users can access data or functions they shouldn't. The most common and impactful issue. Often: forgetting to check tenant or user ownership in queries.
π
A02: Cryptographic Failures
Sensitive data not properly encrypted. Plaintext storage, weak algorithms, hardcoded keys, leaking via logs.
π
A03: Injection
SQL injection, command injection, LDAP, NoSQL. Any case where user input becomes code. Use parameterized queries everywhere.
ποΈ
A04: Insecure Design
Missing security at the architectural level. Missing rate limiting, no MFA option, no audit logging.
βοΈ
A05: Security Misconfiguration
Default credentials, verbose errors leaking internals, unprotected admin endpoints, S3 buckets open to the world.
π¦
A06: Vulnerable Components
Using libraries with known CVEs. Use SBOMs, scanners (Snyk, Dependabot), keep dependencies current.
No audit logs, no anomaly detection, no alerting. Breaches go undetected for months.
π
A10: Server-Side Request Forgery (SSRF)
Server fetches a user-supplied URL β can be tricked into hitting internal resources (cloud metadata services, internal admin pages).
Input Validation and Output Encoding
The single most effective defense against injection.
Validate input
At the boundary
Every external input β API request body, query string, headers, file uploads β validated for type, length, allowed values. Reject what doesn't match.
Encode output
For the destination
Data going into HTML β escape for HTML. Going into SQL β parameterized queries. Going into shell β escape shell. Different destinations, different escaping.
# Wrong β SQL injection vulnerablequery = f"SELECT * FROM users WHERE id = {user_id}"# Right β parameterizedquery = "SELECT * FROM users WHERE id = %s"cursor.execute(query, (user_id,))# Wrong β XSS vulnerablereturn f"<div>Hello {name}</div>"# Right β escape HTMLreturn f"<div>Hello {html.escape(name)}</div>"
Supply Chain Security
Modern apps have hundreds or thousands of transitive dependencies. Each is a potential vulnerability.
π
SBOM β Software Bill of Materials
A complete inventory of dependencies. SPDX or CycloneDX format. Generated by tools like Syft.
π
Vulnerability scanning
Continuously check dependencies against CVE databases. Snyk, Dependabot, Trivy. Run in CI; fail builds on high-severity issues.
π
Lock files + integrity
Pin exact versions (package-lock.json, requirements.txt with hashes). Catches "someone replaced this version with malicious code."
βοΈ
Sign and verify
Cosign, Sigstore for container images. Verify signatures before deployment.
π‘οΈ
Trusted registries
Pull only from verified registries. Mirror public registries internally to catch tampering.
ποΈ
Reproducible builds
Same source code β same binary. Catches build-time tampering.
Secrets Management
Secrets β API keys, DB passwords, certs, encryption keys β are the keys to the kingdom. Treat them carefully.
The traditional security model assumed inside-the-network = trusted. Cloud-native and remote work broke that assumption. Zero trust says: verify everything, regardless of network position.
π
Strong identity
Every actor (user or service) has cryptographic identity. mTLS, signed JWTs, service accounts.
β
Continuous authentication
Not just at login. Re-verify on sensitive operations. Risk-based scoring (unfamiliar device, IP, time β re-auth).
π―
Least privilege
Every actor has the minimum permissions needed. No "admin role for everyone." Fine-grained permissions, time-bound elevations.
π
Audit everything
Every access logged. Centralized logging with anomaly detection. Comprehensive audit trail for forensics.
Network Security in Cloud-Native
π‘οΈ
TLS everywhere
Public traffic, intra-cluster traffic. mTLS for service-to-service in service meshes.
π
Network segmentation
VPCs, subnets, security groups (AWS), NetworkPolicies (K8s). Default-deny; explicitly allow traffic that should flow.
π₯
WAF
Web Application Firewall. Filters common attacks (OWASP Top 10) at the edge. AWS WAF, Cloudflare, Imperva.
πͺ
Private connectivity
PrivateLink, VPC peering, VPN. Don't expose internal services to the internet.
Security Headers
A few HTTP headers that meaningfully reduce attack surface: