Skip to content

Commit

Permalink
uirules: ensure SQL query text is HTML escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Aug 13, 2023
1 parent 6de19cc commit d2ab22b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion uirules/uirules.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ var StripeIDLink = tailsql.UIRewriteRule{
var FormatSQLSource = tailsql.UIRewriteRule{
Value: regexp.MustCompile(`(?is)\b(select\s+.*from|create\s+(table|view))\b`),
Apply: func(col, s string, _ []string) any {
return template.HTML(fmt.Sprintf(`<code><pre>%s</pre></code>`, s))
esc := template.HTMLEscapeString(s)
return template.HTML(fmt.Sprintf(`<code><pre>%s</pre></code>`, esc))
},
}

Expand Down

0 comments on commit d2ab22b

Please sign in to comment.