Skip to content

fix: prevent RCE in openURLMiddleware via URL sanitization - #2758

Merged
thymikee merged 10 commits into
mainfrom
copilot/reamtempt-url-sanitisation
Jan 28, 2026
Merged

fix: prevent RCE in openURLMiddleware via URL sanitization#2758
thymikee merged 10 commits into
mainfrom
copilot/reamtempt-url-sanitisation

Conversation

CopilotAI commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Addresses CVE-2025-11953: URLs passed to the /open-url endpoint were forwarded directly to open(), enabling command injection on Windows via shell metacharacters.

Changes

  • Add strict-url-sanitise dependency for security-focused URL validation
  • Sanitize URLs before passing to open(), rejecting malformed or malicious input with HTTP 400
  • Add test coverage for known attack vectors

Test cases

'https://www.$(calc.exe).com/foo'// Command substitution in hostname'https://evil.com?|calc.exe'// Windows pipe separator'https://example.com/?a=%¾TA%'// Env var exfiltration (%BETA%)
Original prompt

Reattempt #2735 using the strict-url-sanitise npm package. Parsing errors should be surfaced on the HTTP endpoint and fail.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

CopilotAIand others added 2 commits January 27, 2026 21:01
…1953)
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
CopilotAI changed the title [WIP] Reattempt URL sanitisation using strict-url-sanitise packagefix: use strict-url-sanitise to prevent RCE in openURLMiddlewareJan 27, 2026
CopilotAI requested a review from huntieJanuary 27, 2026 21:06
CopilotAIand others added 2 commits January 27, 2026 21:11
… mock
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
CopilotAI changed the title fix: use strict-url-sanitise to prevent RCE in openURLMiddlewarefix: prevent RCE via URL sanitization in openURLMiddlewareJan 27, 2026
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
CopilotAI changed the title fix: prevent RCE via URL sanitization in openURLMiddlewarefix: prevent RCE in openURLMiddleware using strict-url-sanitiseJan 27, 2026
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
CopilotAI changed the title fix: prevent RCE in openURLMiddleware using strict-url-sanitisefix: prevent RCE in openURLMiddleware via URL sanitizationJan 27, 2026
…ltration
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
CopilotAI changed the title fix: prevent RCE in openURLMiddleware via URL sanitizationfix: prevent RCE in openURLMiddleware via strict URL sanitizationJan 27, 2026
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
CopilotAI changed the title fix: prevent RCE in openURLMiddleware via strict URL sanitizationfix: prevent RCE in openURLMiddleware via URL sanitizationJan 27, 2026
@huntie
huntie marked this pull request as ready for review January 27, 2026 22:05
@huntie
huntie requested a review from thymikee as a code ownerJanuary 27, 2026 22:05
@huntie

huntie commented Jan 27, 2026

Copy link
Copy Markdown
Collaborator

@thymikee Ready for review. This is a heavily steered Copilot diff!

@thymikee
thymikee merged commit 45f266c into mainJan 28, 2026
4 of 8 checks passed
@thymikee
thymikee deleted the copilot/reamtempt-url-sanitisation branch January 28, 2026 10:18
azizbecha pushed a commit to azizbecha/react-native-cli that referenced this pull request Jan 29, 2026
…ive-community#2758)
* Initial plan
* fix: use strict-url-sanitise to prevent RCE vulnerability (CVE-2025-11953)
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* refactor: cache sanitizeUrl to improve performance
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* simplify: use "Invalid URL" error message, remove strict-url-sanitise mock
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* style: replace it() with test() in openURLMiddleware tests
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* refactor: use ordinary import for strict-url-sanitise
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* refactor: remove named export of openURLMiddleware, test default export
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* test: add CVE-2025-11953 test cases for Windows pipe and command exfiltration
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* test: add CVE-2025-11953 comment above second test case
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
* fixup tests to not hang when fail
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huntie <2547783+huntie@users.noreply.github.com>
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
This was referenced Jun 23, 2026
leotm added a commit to leotm/react-native-template-new-architecture that referenced this pull request Jun 30, 2026
- revert d1b5e9c patch fix
- bump @react-native-community/cli
- bump @react-native-community/cli-platform-android
- bump @react-native-community/cli-platform-ios
Resolve: #1994
Supersedes
- #1980
- #2012
- #2013
Ref
- react-native-community/template#231
- react-native-community/template#232
- react/react-native#57344
Includes URL sanitisation fix (v20.1.1 regression)
- react-native-community/cli#2814
- react-native-community/cli#2812
- react-native-community/cli#2758
- react-native-community/cli#2735
- react-native-community/cli#2697
leotm added a commit to leotm/react-native-template-new-architecture that referenced this pull request Jun 30, 2026
- revert d1b5e9c patch fix
- bump @react-native-community/cli
- bump @react-native-community/cli-platform-android
- bump @react-native-community/cli-platform-ios
Resolve: #1994
Supersedes
- #1980
- #2012
- #2013
Ref
- react-native-community/template#231
- react-native-community/template#232
- react/react-native#57344
Includes URL sanitisation fix (v20.1.1 regression)
- react-native-community/cli#2814
- react-native-community/cli#2812
- react-native-community/cli#2758
- react-native-community/cli#2735
- react-native-community/cli#2697
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@huntie@thymikee