Only allowing a subset of characters in themeVariables

This commit is contained in:
Knut Sveidqvist
2022-06-21 21:17:53 +02:00
parent 566ec14648
commit ec2da8e85d
5 changed files with 104 additions and 1 deletions

View File

@@ -1044,6 +1044,17 @@ export const directiveSanitizer = (args) => {
});
}
}
if (args.themeVariables) {
const kArr = Object.keys(args.themeVariables);
for (let i = 0; i < kArr.length; i++) {
const k = kArr[i];
const val = args.themeVariables[k];
if (!val.match(/^[a-zA-Z0-9#;]+$/)) {
args.themeVariables[k] = '';
}
}
}
log.debug('After sanitization', args);
};
export const sanitizeCss = (str) => {
const stringsearch = 'o';