mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
fix: Hide error details from production users in ErrorBoundary
Security fix for PR #1186: ErrorBoundary was leaking internal implementation details (stack traces, error messages) to end users in production. - Gate error details section to development mode only using import.meta.env.DEV - In production, only show generic error message and reload button - Prevents information disclosure while maintaining debugging capability in dev Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -26,6 +26,9 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||
|
||||
public render(): ReactNode {
|
||||
if (this.state.hasError) {
|
||||
// Only show error details in development mode to avoid leaking implementation details
|
||||
const isDev = import.meta.env.DEV
|
||||
|
||||
return (
|
||||
<div style={styles.container}>
|
||||
<h1 style={styles.heading}>Something went wrong</h1>
|
||||
@@ -33,7 +36,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||
<button style={styles.button} onClick={() => window.location.reload()}>
|
||||
Reload Application
|
||||
</button>
|
||||
{this.state.error && (
|
||||
{isDev && this.state.error && (
|
||||
<details style={styles.details}>
|
||||
<summary style={styles.summary}>Error Details</summary>
|
||||
<pre style={styles.pre}>{this.state.error.toString()}</pre>
|
||||
|
||||
Reference in New Issue
Block a user