Chapter 32 — Further Reading

Injection & app security (everyone)

  • OWASP Top Ten and the OWASP SQL Injection Prevention Cheat Sheet. The authoritative, practical guides; parameterization first, defense in depth throughout.
  • OWASP Authentication / Password Storage Cheat Sheets — how to hash passwords correctly (bcrypt/argon2, salts, work factors).

Access control (🏗️ DBA · 💻 Developer)

  • PostgreSQL Docs: "Database Roles" and "Privileges" (GRANT/REVOKE). Roles, role membership, object and column privileges, default privileges. The basis of least privilege.
  • PostgreSQL Docs: "Row Security Policies" (RLS). Enabling RLS, CREATE POLICY, USING/WITH CHECK — the Case Study 2 fix. Essential for multi-tenancy.

Encryption & transport (🏗️ DBA)

  • PostgreSQL Docs: "Secure TCP/IP Connections with SSL" — requiring/verifying TLS (sslmode).
  • pgcrypto extension — column-level encryption and hashing functions.
  • Encryption-at-rest options — full-disk/volume encryption, cloud-provider encryption; trade-offs.

Backup, audit, privacy (🏗️ DBA · 📊 Analyst)

  • pgAudit — detailed audit logging for compliance.
  • PostgreSQL Docs: "Backup and Restore" (and Chapter 38) — pg_dump, PITR, tested restores.
  • GDPR / CCPA / HIPAA primers for engineers — data minimization, access, right to erasure, breach notification. Connects to the Data, Society, and Responsibility themes of the broader series.

Reference (this book)

  • Chapter 29 — psycopg2: parameterized queries (the injection defense in code).
  • Chapter 21 — Patterns: multi-tenancy models RLS protects; audit-trail triggers.
  • Chapter 38 — Administration: backups, PITR, and operational security.

Do, don't just read

  • Build Case Study 1's contrast: run an injection against a throwaway DB as superuser vs. as a limited role; see what each can (and can't) do.
  • Build Case Study 2's RLS: add a tenant policy, then run a query with no WHERE and confirm it returns only the current tenant's rows.
  • Audit your own project: confirm every query is parameterized, the app uses a least-privilege role, and TLS is required.

Next: Chapter 33 — NoSQL — Part VI begins: when relational isn't the answer.