backend: fix XSS in team name and events
This commit is contained in:
parent
ca8bac1ac8
commit
429cd3010c
4 changed files with 9 additions and 5 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"html"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
|
@ -49,7 +50,7 @@ func treatOpeningHint(pathname string, team fic.Team) {
|
|||
log.Printf("%s [WRN] %s\n", id, err)
|
||||
} else if theme, err := fic.GetTheme(exercice.IdTheme); err != nil {
|
||||
log.Printf("%s [WRN] %s\n", id, err)
|
||||
} else if _, err = fic.NewEvent(fmt.Sprintf("L'équipe %s a dévoilé un indice pour le <strong>%d<sup>e</sup></strong> défi %s !", team.Name, lvl, theme.Name), "info"); err != nil {
|
||||
} else if _, err = fic.NewEvent(fmt.Sprintf("L'équipe %s a dévoilé un indice pour le <strong>%d<sup>e</sup></strong> défi %s !", html.EscapeString(team.Name), lvl, theme.Name), "info"); err != nil {
|
||||
log.Printf("%s [WRN] Unable to create event: %s\n", id, err)
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue