Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Context
Migrating the remaining core dev server endpoints from
@react-native-community/cli-server-apiinto core (@react-native/community-cli-plugin), so the Community CLI no longer serves them.This diff
/open-stack-frameand/open-url, which LogBox, RedBox and the new app screen call to open a stack frame in the editor or a docs link in the browser, are served only by@react-native-community/cli-server-api, so the dev server depends on the Community CLI for them. The CLI's stack frame handler also opens any path on disk.This diff moves both routes into
@react-native/community-cli-plugin, mounted by thestartcommand's dev server, and ports the hardening Expo applied to its own/open-stack-frame(expo/expo#44039, expo/expo#45863). The plugin is a halfway house: the routes leave the CLI now, and can lift into@react-native/dev-middlewareonce Expo adopts them, with that API designed against Expo's needs.Changes
launch-editorand$REACT_EDITORas in the CLI.http:orhttps:only, with none of the characters PowerShell expands, sinceopenlaunches through a PowerShell string on Windows (CVE-2025-11953).Notes
Changelog:
[General][Changed] - Dev server:
/open-stack-frameopens only files inside the project watch folders and/open-urlonlyhttp(s)URLs, both served by@react-native/community-cli-pluginTest Plan
✅ 47 tests pass: launches with the posted file and line or URL, same-origin, other local and cross-origin requests, malformed bodies, containment (
.., a symlink out, a nonexistent file, a watch folder itself), rejected URL schemes and shell characters, the throttles, a failed browser launch, a GET passing through, and a response an earlier middleware already sent. Flow and ESLint clean.RNTester's Metro with a local
cli-server-apicarrying react-native-community/cli#2875 linked in, so the plugin serves both routes, and$REACT_EDITORset to a script that logs each launch:curl -X POST /open-stack-frameforRNTesterAppShared.jsanswered200 OKand the script logged the file. For/etc/hosts:400, "File is missing or outside the project watch folders".curl -X POST /open-urlwithhttp://localhost:<port>/statusanswered200 OKand opened the browser. Forfile:///etc/passwd:400.Originheader is answered by the CLI's own guard, mounted first, with its500.Not run on this revision: tapping a LogBox frame on a simulator, which the previous revision ran with the same handler logic.