Skip to content

Commit 55557f8

Browse files
Use API graohs directly
1 parent 6e16ed5 commit 55557f8

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

python/ql/lib/semmle/python/frameworks/Jinja2.qll

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,13 @@ module Jinja2 {
3333
result = ModelOutput::getATypeNode("jinja.Environment~Subclass").getASubclass*()
3434
}
3535

36-
/** Gets a reference to an instance of `jinja2.Environment`. */
37-
private DataFlow::TypeTrackingNode instance(DataFlow::TypeTracker t) {
38-
t.start() and
39-
result = EnvironmentClass::classRef().getACall()
40-
or
41-
exists(DataFlow::TypeTracker t2 | result = instance(t2).track(t2, t))
42-
}
43-
44-
/** Gets a reference to an instance of `jinja2.Environment`. */
45-
DataFlow::Node instance() { instance(DataFlow::TypeTracker::end()).flowsTo(result) }
36+
API::Node instance() { result = classRef().getAnInstance() }
4637

4738
/** A call to `jinja2.Environment.from_string`. */
48-
private class Jinja2FromStringConstruction extends TemplateConstruction::Range,
49-
DataFlow::MethodCallNode
50-
{
51-
Jinja2FromStringConstruction() { this.calls(EnvironmentClass::instance(), "from_string") }
39+
private class Jinja2FromStringConstruction extends TemplateConstruction::Range, API::CallNode {
40+
Jinja2FromStringConstruction() {
41+
this = EnvironmentClass::instance().getMember("from_string").getACall()
42+
}
5243

5344
override DataFlow::Node getSourceArg() { result = this.getArg(0) }
5445
}

0 commit comments

Comments
 (0)