Skip to content

Commit 46c5cb1

Browse files
committed
Polish WerkzeugHeaderCall
1 parent 6f89b3f commit 46c5cb1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python/ql/src/experimental/Security/CWE-113/HeaderInjection.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ import semmle.python.dataflow.new.DataFlow
1717
import semmle.python.dataflow.new.TaintTracking
1818
import semmle.python.ApiGraphs
1919
import DataFlow::PathGraph
20-
import semmle.python.frameworks.Flask
2120

22-
class WerkzeugHeader extends DataFlow::Node {
23-
WerkzeugHeader() {
24-
exists(DataFlow::CallCfgNode headerInstance, DataFlow::AttrRead addMethod |
25-
headerInstance =
21+
class WerkzeugHeaderCall extends DataFlow::CallCfgNode {
22+
WerkzeugHeaderCall() {
23+
exists(DataFlow::AttrRead addMethod |
24+
this.getFunction() = addMethod and
25+
addMethod.getObject().getALocalSource() =
2626
API::moduleImport("werkzeug").getMember("datastructures").getMember("Headers").getACall() and
27-
addMethod.getAttributeName() = "add" and
28-
addMethod.getObject().getALocalSource() = headerInstance and
29-
this = addMethod.(DataFlow::CallCfgNode).getArg(1)
27+
addMethod.getAttributeName() = "add"
3028
)
3129
}
30+
31+
DataFlow::Node getHeaderInputNode() { result = this.getArg(1) }
3232
}
3333

3434
class FlaskHeader extends DataFlow::Node {

0 commit comments

Comments
 (0)