Skip to content

Commit c1ef946

Browse files
committed
Log error message if file name does not pass whitelist
1 parent 7814826 commit c1ef946

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/react-dev-utils/launchEditor.js

+12
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,18 @@ function launchEditor(fileName, lineNumber, colNumber) {
321321
process.platform === 'win32' &&
322322
!WINDOWS_FILE_NAME_WHITELIST.test(fileName.trim())
323323
) {
324+
console.log();
325+
console.log(
326+
chalk.red('Could not open ' + path.basename(fileName) + ' in the editor.')
327+
);
328+
console.log();
329+
console.log(
330+
'When running on Windows, file names are checked against a whitelist ' +
331+
'to protect against remote code execution attacks. File names may ' +
332+
'consist only of alphanumeric characters (all languages), periods, ' +
333+
'dashes, slashes, and underscores.'
334+
);
335+
console.log();
324336
return;
325337
}
326338

0 commit comments

Comments
 (0)