Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit a340270

Browse files
committed
Move html TemplateEscape out of Texttemplate module
1 parent 9a560e9 commit a340270

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

ql/src/semmle/go/frameworks/stdlib/HtmlTemplate.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ import go
66

77
/** Provides models of commonly used functions in the `html/template` package. */
88
module HtmlTemplate {
9+
private class TemplateEscape extends EscapeFunction::Range {
10+
string kind;
11+
12+
TemplateEscape() {
13+
exists(string fn |
14+
fn.matches("HTMLEscape%") and kind = "html"
15+
or
16+
fn.matches("JSEscape%") and kind = "js"
17+
or
18+
fn.matches("URLQueryEscape%") and kind = "url"
19+
|
20+
this.hasQualifiedName("html/template", fn)
21+
)
22+
}
23+
24+
override string kind() { result = kind }
25+
}
26+
927
private class FunctionModels extends TaintTracking::FunctionModel {
1028
FunctionInput inp;
1129
FunctionOutput outp;

ql/src/semmle/go/frameworks/stdlib/TextTemplate.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ module TextTemplate {
1818
fn.matches("URLQueryEscape%") and kind = "url"
1919
|
2020
this.hasQualifiedName("text/template", fn)
21-
or
22-
this.hasQualifiedName("html/template", fn)
2321
)
2422
}
2523

0 commit comments

Comments
 (0)