ban / as a path

This commit is contained in:
Robert Brignull 2020-07-10 15:02:18 +01:00
parent 1a4c658bbf
commit 189b6ef4bf
3 changed files with 15 additions and 1 deletions

5
lib/config-utils.js generated
View file

@ -125,6 +125,11 @@ function validateAndSanitisePath(originalPath, propertyName, configFile) {
if (path.endsWith('/**')) {
path = path.substring(0, path.length - 2);
}
// An empty path is not allowed as it's meaningless
if (path === '') {
throw new Error(getConfigFilePropertyError(configFile, propertyName, '"' + originalPath + '" is not an invalid path. ' +
'It is not necessary to include it, and it is not allowed to exclude it.'));
}
// Check for illegal uses of **
if (path.match(pathStarsRegex)) {
throw new Error(getConfigFilePropertyError(configFile, propertyName, '"' + originalPath + '" contains an invalid "**" wildcard. ' +

File diff suppressed because one or more lines are too long

View file

@ -142,6 +142,15 @@ export function validateAndSanitisePath(
path = path.substring(0, path.length - 2);
}
// An empty path is not allowed as it's meaningless
if (path === '') {
throw new Error(getConfigFilePropertyError(
configFile,
propertyName,
'"' + originalPath + '" is not an invalid path. ' +
'It is not necessary to include it, and it is not allowed to exclude it.'));
}
// Check for illegal uses of **
if (path.match(pathStarsRegex)) {
throw new Error(getConfigFilePropertyError(