Skip to content

Commit 9504f36

Browse files
committed
Restrict text/template modelling to known call targets
Otherwise it's too easy to define a common interface to both text/template, which doesn't sanitize, and html/template, which does.
1 parent 016bda0 commit 9504f36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: go/ql/lib/semmle/go/frameworks/stdlib/TextTemplate.qll

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module TextTemplate {
8888
private class ExecuteTemplateFieldReader extends DataFlow::ImplicitFieldReadNode {
8989
override predicate shouldImplicitlyReadAllFields(DataFlow::Node n) {
9090
exists(ExecuteTemplateMethod m, DataFlow::MethodCallNode cn |
91-
cn.getACalleeIncludingExternals().asFunction() = m and
91+
cn.getTarget() = m and
9292
n = cn.getArgument(m.getInputArgIdx())
9393
)
9494
}

0 commit comments

Comments
 (0)