Repository navigation
Conversation
|
@copilot Please adversarially review this PR for CVE-2025-11953, and comment with your result. |
Review result: I found no CVE-2025-11953 command-injection path in the new plugin handler. It accepts only parsed HTTP(S) URLs and rejects PowerShell expansion characters before calling |
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. --> ## Summary Motivated by #59316. Changelog: [Internal] ## Test Plan ``` yarn prettier --check AGENTS.md ``` ✅ Clean. Documentation only. Differential Revision: D128379539 Pull Request resolved: #59621
Summary
Context
Migration of the remaining core dev server endpoints from
@react-native-community/cli-server-apiinto core (community-cli-plugin).Core motivation: These endpoints are critical infra! Most notably the WS
/messageendpoint, which carries reload and Dev Menu commands from the terminal and other tools.The intent is to later move most of these again into
dev-middleware(shared by CLI and Expo). For now, this stack focuses on decoupling CLI as an initial migration. (I note also thatfb-metro-cliprobably can't accept moving all of these intodev-middlewarejust yet.)This diff
Migrate the
/open-stack-frame(used by LogBox, RedBox) and/open-url(used bynew-app-screen) routes to core.Additionally, port the hardening Expo CLI applied to its own
/open-stack-frame(expo/expo#44039, expo/expo#45863).Paired with react-native-community/cli#2875, which removes the CLI's copies.
Net changes
This is a non-breaking change when CLI and react-native are shipped in lockstep.
This diff also tightens behaviour compared to the CLI versions:
/open-stack-frame: Validate the posted frame, and only open files that resolves inside the server root or a watch folder.Notes
main(until we publish a new CLI beta), the older CLI copy is still mounted and used first (local testing was validated properly).Changelog:
[General][Changed] - Dev server: Guard
/open-stack-frameto only open files inside the project watch foldersTest Plan
✅ 25 tests pass: launches with the posted file and line or URL, a relative path, cross-origin requests, malformed bodies, containment (a file outside, a symlink out, a nonexistent file), rejected URL schemes and shell characters, the throttles, a failed browser launch, and a GET passing through. 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.✅ RNTester on iPhone 18 Pro (iOS 27.0), with this stack: tapping the top frame of the Crash example's LogBox (
CrashExample.js:34:26) launched$REACT_EDITORwithCrashExample.js.