mirror of
https://github.com/github/codeql.git
synced 2026-01-31 15:22:57 +01:00
Fix test
This commit is contained in:
4
ql/test/experimental/CWE-79/HTMLTemplateEscapingPassthrough.go
Executable file → Normal file
4
ql/test/experimental/CWE-79/HTMLTemplateEscapingPassthrough.go
Executable file → Normal file
@@ -71,13 +71,13 @@ func bad(req *http.Request) {
|
||||
func good(req *http.Request) {
|
||||
tmpl, _ := template.New("test").Parse(`Hello, {{.}}\n`)
|
||||
{ // This will be escaped, so it shoud NOT be caught:
|
||||
var escaped = source(`<a href="example.com">link</a>`)
|
||||
var escaped = req.UserAgent()
|
||||
checkError(tmpl.Execute(os.Stdout, escaped))
|
||||
}
|
||||
{
|
||||
// The converted source value does NOT flow to tmpl.Exec,
|
||||
// so this should NOT be caught.
|
||||
src := source(`<a href='example.com'>link</a>`)
|
||||
src := req.UserAgent()
|
||||
converted := template.HTML(src)
|
||||
_ = converted
|
||||
checkError(tmpl.Execute(os.Stdout, src))
|
||||
|
||||
Reference in New Issue
Block a user