Vulnerabilities & Secure Practices¶
Complements auth topics in Spring & Web → Security.
OWASP Top 10 (2021)¶
- Broken access control
- Cryptographic failures
- Injection (SQL, command, LDAP)
- Insecure design
- Security misconfiguration
- Vulnerable & outdated components
- Identification & authentication failures
- Software & data integrity failures
- Security logging & monitoring failures
- Server-Side Request Forgery (SSRF)
Common attacks & defenses¶
| Attack | Defense |
|---|---|
| SQL injection | parameterized queries / prepared statements, ORM |
| XSS | output encoding, CSP, sanitize input |
| CSRF | anti-CSRF tokens, SameSite cookies |
| SSRF | allow-list outbound hosts, block internal ranges |
| Broken access control | server-side authz checks, deny by default |
| Sensitive data exposure | TLS, encryption at rest, mask PII in logs |
Dependency / supply-chain security¶
- Scan dependencies for CVEs (OWASP Dependency-Check, Snyk, WIZ, PRISMA); pin non-vulnerable versions.
- Keep libraries patched; watch advisories (e.g. Log4Shell). Reference: CISA KEV catalog.
Secure coding principles¶
Least privilege · defense in depth · fail securely · validate at boundaries · never trust client input · secrets in a vault (not code) · constant-time comparison for secrets · rotate credentials · audit logging.