A useful public error says what the user can do next. A useful protected log preserves what the authorized maintainer needs to diagnose. Mixing the two can expose the application.
OWASP recommends a generic response for unexpected errors while keeping error detail server-side for investigation. Stack traces, framework versions, file paths, queries, tokens, and private records do not belong in the client response.
The six-step defensive build
- Centralize handling. Route unexpected exceptions through a controlled application handler.
- Return a generic response. Give the user a calm message and a safe next action without internal detail.
- Create a correlation reference. Use a random, nonsecret identifier that points authorized staff to the protected event; never encode customer data or a stack trace in it.
- Protect the diagnostic record. Restrict access, minimize personal data, prevent log injection, and preserve retention and monitoring rules.
- Repair the root cause. Do not treat message hiding as the fix.
- Retest from a fresh context. Verify both surfaces: generic outside, useful and access-controlled inside.
Synthetic test
In a local or isolated application you own, create one deliberately handled test error—never on another person’s system. Confirm the client sees no stack, query, path, secret, or private data. Confirm the protected record contains only the minimum diagnostic context and can be found with the correlation reference.
AI boundary
Do not paste production logs, credentials, private configurations, customer records, or undisclosed vulnerabilities into a public AI service. Use synthetic fixtures or a locally authorized, data-controlled workflow. Human owners keep authority over triage, access, repair, and release.
Stop-condition table
| Observed condition | Required response |
|---|---|
| The client response exposes internal detail | Stop release, remove the detail, repair the handler, and retest |
| The correlation value is predictable or contains private data | Replace it with a random, nonsecret lookup reference |
| The log is public, overbroad, or accepts untrusted input without control | Restrict access, minimize fields, protect integrity, and review retention |
| The target is not owned or explicitly authorized | Do not test |
| No responsible human can receive or act on the evidence | Hold release until ownership and escalation exist |
Primary sources
Discover more from Louisville Institute of Technology (LIT) - Louisville, KY
Subscribe to get the latest posts sent to your email.