Use file name whitelist to prevent RCE (#4866)
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

mangomint/create-react-app,facebookincubator/create-react-app,jdcrensh/create-react-app,Timer/create-react-app,viankakrisna/create-react-app,infernojs/create-inferno-app,GreenGremlin/create-react-app,IamJoseph/create-react-app,IamJoseph/create-react-app,d3ce1t/create-react-app,Timer/create-react-app,ConnectedHomes/create-react-web-app,d3ce1t/create-react-app,mangomint/create-react-app,amido/create-react-app,ConnectedHomes/create-react-web-app,timlogemann/create-react-app,amido/create-react-app,jdcrensh/create-react-app,timlogemann/create-react-app,viankakrisna/create-react-app,ConnectedHomes/create-react-web-app,timlogemann/create-react-app,infernojs/create-inferno-app,IamJoseph/create-react-app,timlogemann/create-react-app,d3ce1t/create-react-app,viankakrisna/create-react-app,GreenGremlin/create-react-app,d3ce1t/create-react-app,mangomint/create-react-app,jdcrensh/create-react-app,Timer/create-react-app,mangomint/create-react-app,infernojs/create-inferno-app,facebookincubator/create-react-app,ConnectedHomes/create-react-web-app,GreenGremlin/create-react-app,GreenGremlin/create-react-app,amido/create-react-app,jdcrensh/create-react-app,facebookincubator/create-react-app,Timer/create-react-app