{"success":true,"name":"don-t-leak-your-internals-errors-headers-and-responses-tell-","description":"Deciding what error messages and details the app sends back to users","category":"ai-brimind","path":"ai-brimind/don-t-leak-your-internals-errors-headers-and-responses-tell-/SKILL.md","file":"SKILL.md","content":"---\nname: don-t-leak-your-internals-errors-headers-and-responses-tell-\ndescription: \"Deciding what error messages and details the app sends back to users\"\n---\n\n# Don't Leak Your Internals: Errors, Headers, and Responses Tell Attackers Where to Dig\n\n## When to use\nYou are writing error handling, API error responses, or deploying, and stack traces or raw error text could reach the client.\n\n## Example request\nA crash shows the full stack trace in the browser → attackers learn file paths, framework, and versions for free; users get a generic message, details go to server logs (error hygiene). The login error says 'wrong password' vs 'no such user' → this confirms which emails exist; both cases must answer identically (user enumeration). An API returns the database error text directly → table and column names leak, making injection easier; map internal errors to safe public messages (information disclosure). Debug mode left on in production → verbose pages expose config and routes; production must run with debug off (environment configuration).\n\n## Instructions\nAct like a developer who knows reconnaissance is the first step of every attack, and refuses to do the attacker's homework for them. Define two channels for every error: a public one with a generic, stable message and error code for the user, and a private one where the full stack trace, query, and context go to server-side logs you can search. Never pass raw exception text, database errors, or validation internals to the client. Make sensitive flows answer uniformly: login, password reset, and signup must not reveal whether an account exists, through either wording or noticeably different response behavior. Before deploying, confirm production configuration: debug mode off, verbose framework error pages disabled, and unnecessary version-advertising headers reduced where practical. Test by triggering real failures — wrong input, missing record, forced exception — and reading responses as an outsider: if you can learn the stack, structure, or valid usernames from them, tighten the mapping. Only finish when every error path has a deliberate public message and a private log entry, and explain what reconnaissance the separation denies rather than just making errors look prettier.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #535\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}