Module lessons (1/3)
Safe Error Handling & Correlation IDs
Strip internal SQL messages and stack traces from API responses while preserving safe validation errors and request trace IDs.
What you'll learn in this lesson
- Identify how unhandled stack traces, raw SQL error strings, and connection URIs accelerate attacker reconnaissance (OWASP A05 Information Disclosure).
- Separate private structured telemetry logs (with DB credential and Bearer redaction) from opaque client error envelopes keyed by a
correlationId. - Stop account enumeration and accidental schema leaks inside
expose: true4xx validation messages.
Overview
When a database driver exception like ERROR: column "sec_users.password_hash" does not exist near pg://app:s3cr3t@db.internal:5432/prod at /app/src/routes/auth.ts:48 leaks directly into an HTTP JSON response, you just handed an attacker your table schema, database credentials, and source tree layout in a single response.
Even worse, well-meaning developers often mark custom 4xx errors as public (expose: true) and accidentally concatenate raw database messages into them — or leak user existence by returning 'Email not found' vs 'Wrong password' on login and password-reset endpoints.
Sections covered in this lesson
- 11. Error Disclosure vs Correlation-ID Architecture
- 22. Interactive Explorer: Audit Log & Forensic Correlation
- 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
- 44. Checkpoints & Code Review
Unlock "Safe Error Handling & Correlation IDs" and the full Application & Web Security curriculum
Strip internal SQL messages and stack traces from API responses while preserving safe validation errors and request trace IDs.
Unlock all 6 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Application & Web Security plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.