mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
JS: Handle Array.prototype.toString calls
This commit is contained in:
@@ -157,7 +157,11 @@ class Values extends SummarizedCallable {
|
||||
class ToString extends SummarizedCallable {
|
||||
ToString() { this = "Object#toString / Array#toString" }
|
||||
|
||||
override DataFlow::MethodCallNode getACallSimple() { result.getMethodName() = "toString" }
|
||||
override InstanceCall getACallSimple() {
|
||||
result.(DataFlow::MethodCallNode).getMethodName() = "toString"
|
||||
or
|
||||
result = arrayConstructorRef().getAPropertyRead("prototype").getAMemberCall("toString")
|
||||
}
|
||||
|
||||
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
|
||||
preservesValue = false and
|
||||
|
||||
@@ -41,5 +41,5 @@ function implicitToString() {
|
||||
sink(array.toString()); // $ hasTaintFlow=implicitToString.1 hasTaintFlow=implicitToString.2
|
||||
sink(array.toString("utf8")); // $ hasTaintFlow=implicitToString.1 hasTaintFlow=implicitToString.2
|
||||
|
||||
sink(Array.prototype.toString.call(array)); // $ MISSING: hasTaintFlow=implicitToString.1 hasTaintFlow=implicitToString.2
|
||||
sink(Array.prototype.toString.call(array)); // $ hasTaintFlow=implicitToString.1 hasTaintFlow=implicitToString.2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user