Merge pull request #5397 from erik-krogh/globalSanitizer

Approved by asgerf
This commit is contained in:
CodeQL CI
2021-03-16 05:37:32 -07:00
committed by GitHub
4 changed files with 37 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ module Shared {
abstract class SanitizerGuard extends TaintTracking::SanitizerGuardNode { }
/**
* A regexp replacement involving an HTML meta-character, viewed as a sanitizer for
* A global regexp replacement involving an HTML meta-character, viewed as a sanitizer for
* XSS vulnerabilities.
*
* The XSS queries do not attempt to reason about correctness or completeness of sanitizers,
@@ -36,6 +36,7 @@ module Shared {
*/
class MetacharEscapeSanitizer extends Sanitizer, StringReplaceCall {
MetacharEscapeSanitizer() {
this.isGlobal() and
exists(RegExpConstant c |
c.getLiteral() = getRegExp().asExpr() and
c.getValue().regexpMatch("['\"&<>]")