mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-23 04:40:23 +08:00
Use file name whitelist to prevent RCE (#4866)
* Use file name whitelist to prevent RCE
Use a whitelist to validate user-provided file names. This doesn't cover
the entire range of valid filenames but should cover almost all of them
in practice. Allows letters, numbers, periods, dashes, and underscores.
Opting to use a whitelist instead of a blacklist because getting this
wrong leaves us vulnerable to a RCE attack.
* Allow alphabet characters from all languages
Updated the whitelist to /^[\p{L}0-9/.\-_]+$/u, which matches
alphanumeric characters, periods, dashes, and underscores. Unicode
property support is stage 4 so I've inlined the transpiled version.
* Only use file name whitelist on Windows
* Log error message if file name does not pass whitelist
This commit is contained in:
committed by
Dan Abramov
parent
ca5998326d
commit
24b101d233
28
packages/react-dev-utils/launchEditor.js
vendored
28
packages/react-dev-utils/launchEditor.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user