T09 · Insecure Skill Coding Practices
Warning
- Location
- ADVANCED.md:18
- Finding
- Production Error Boundary Exposes Exception Messages and Stack Traces<![CDATA[ ## Vulnerability Details **File Location**: `ADVANCED.md:18-25` **Vulnerability Type**: Sensitive diagnostic information exposure **Risk Level**: Medium ### Vulnerable Code ```tsx } else if (error instanceof Error) { return ( <div> <h1>Error</h1> <p>{error.message}</p> <pre>{error.stack}</pre> </div> ); } ``` ### Technical Analysis The documented root error boundary renders both `error.message` and `error.stack` directly in the browser without restricting this behavior to development environments. Stack traces and raw exception messages may reveal source paths, module and component names, application structure, implementation details, dependency internals, database-related errors, or sensitive values included in exception messages. Because the section presents this as a required root error boundary without a production safety warning, users of the Skill may reproduce the unsafe pattern in deployed applications. ### Attack Path 1. An attacker identifies a route or input that causes an unhandled application exception. 2. The exception propagates to `RootErrorBoundary`. 3. The boundary recognizes the value as an `Error`. 4. The application returns `error.message` and `error.stack` in the rendered page. 5. The attacker uses the disclosed diagnostic information to map internal application components, source layout, dependencies, or vulnerable code paths. ### Impact Assessment This issue does not directly grant additional system privileges or execute attacker-controlled code. Its scope is information disclosure to any user able to trigger or observe an error boundary. Disclosed implementation details may support reconnaissance and make subsequent attacks more precise. The exact exposure depends on the contents of runtime exceptions. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions - Replace raw exception output with a generic production-safe message. - Render stack traces only behind an explicit development-environment check such as `import.meta.env.DEV`. - Send detailed diagnostics to an access-controlled server-side logging or monitoring system instead of returning them to clients. - Sanitize exception messages and ensure secrets, credentials, tokens, personal data, and database details are never embedded in user-visible errors. - Add guidance distinguishing development diagnostics from production error handling. Example hardened pattern: ```tsx } else if (error instanceof Error) { if (import.meta.env.DEV) { return ( <div> <h1>Error</h1> <p>{error.message}</p> <pre>{error.stack}</pre> </div> ); } return ( <div> <h1>Something went wrong</h1> <p>Please try again later.</p> </div> ); } ``` ]]>
