Skip to content

Commit

Permalink
Restrict text/template modelling to known call targets
Browse files Browse the repository at this point in the history
Otherwise it's too easy to define a common interface to both text/template, which doesn't sanitize, and html/template, which does.
  • Loading branch information
smowton committed Dec 19, 2024
1 parent 649e9a8 commit 9861af8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go/ql/lib/semmle/go/frameworks/stdlib/TextTemplate.qll
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module TextTemplate {
private class ExecuteTemplateFieldReader extends DataFlow::ImplicitFieldReadNode {
override predicate shouldImplicitlyReadAllFields(DataFlow::Node n) {
exists(ExecuteTemplateMethod m, DataFlow::MethodCallNode cn |
cn.getACalleeIncludingExternals().asFunction() = m and
cn.getTarget() = m and
n = cn.getArgument(m.getInputArgIdx())
)
}
Expand Down

0 comments on commit 9861af8

Please sign in to comment.