reuse existing logic in DomBasedXss

This commit is contained in:
Erik Krogh Kristensen
2020-04-22 13:50:43 +02:00
parent a5bbfa30d1
commit 0a29d132d0

View File

@@ -62,13 +62,14 @@ module XssThroughDom {
this.getArgument(0).mayHaveStringValue(unsafeAttributeName())
) and
// looks like a $("<p>" + ... ) source, which is benign for this query.
not this
.getReceiver()
.(DataFlow::CallNode)
.getAnArgument()
.(StringOps::ConcatenationRoot)
.getConstantStringParts()
.substring(0, 1) = "<"
not exists(DataFlow::Node prefix |
DomBasedXss::isPrefixOfJQueryHtmlString(this
.getReceiver()
.(DataFlow::CallNode)
.getAnArgument(), prefix)
|
prefix.getStringValue().regexpMatch("\\s*<.*")
)
}
}