fix: prevent Test ErrorBoundary access in production mode #6340
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes issue #6335 where users could access Test ErrorBoundary functionality in production builds, causing critical errors.
Problem
The
exposeSourceMapsForDebuggingfunction insourceMapInitializer.tswas incorrectly exposing debugging functions like__testSourceMapsin production mode. This allowed users to trigger the Test ErrorBoundary functionality even after the UI button was removed, causing the error:Solution
exposeSourceMapsForDebuggingto only expose debugging functions in development modeif (process.env.NODE_ENV !== "production")toif (process.env.NODE_ENV === "production")to return early in productionTesting
sourceMapInitializer.spec.tswith 4 test casesImpact
Fixes #6335
Important
Fix
exposeSourceMapsForDebuggingto prevent exposing debugging functions in production mode and add tests to verify behavior.exposeSourceMapsForDebugginginsourceMapInitializer.tsto prevent exposing debugging functions in production mode.if (process.env.NODE_ENV === "production")to return early in production.sourceMapInitializer.spec.tswith tests verifying debugging functions are not exposed in production.This description was created by
for 59aed9a. You can customize this summary. It will automatically update as commits are pushed.