templates: escape query value in ping page
elem-go does not escape attribute values, so the raw query reaches the rendered HTML verbatim. Pre-escape with html.EscapeString to prevent reflected XSS. Updates #3157
This commit is contained in:
parent
3a4af8cf87
commit
f3eb9a7bba
3 changed files with 28 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package templates
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"html"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -101,7 +102,7 @@ func pingForm(query string) *elem.Element {
|
|||
elem.Input(attrs.Props{
|
||||
attrs.Type: "text",
|
||||
attrs.Name: "node",
|
||||
attrs.Value: query,
|
||||
attrs.Value: html.EscapeString(query),
|
||||
attrs.Placeholder: "Node ID, IP, or hostname",
|
||||
attrs.Autofocus: "true",
|
||||
attrs.Style: styles.Props{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue