Skip to content

Commit 0c988fc

Browse files
Security fixes (#125)
1 parent faef4c9 commit 0c988fc

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 2.40.1
4+
5+
- Security fixes (thanks @tonghuaroot for
6+
[the report](https://github.com/lucasdillmann/nginx-ignition/security/advisories/GHSA-jr34-h97m-9hpx)!)
7+
38
## 2.40.0
49

510
- Users can now update their own name and username from the account settings modal in the shell header.

api/common/server/i18n.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@ package server
22

33
import (
44
"context"
5+
"strings"
56

67
"github.com/gin-gonic/gin"
78
"golang.org/x/text/language"
89

910
"dillmann.com.br/nginx-ignition/core/common/i18n"
1011
)
1112

13+
const maximumLanguageTags = 10
14+
1215
func i18nMiddleware(commands i18n.Commands) gin.HandlerFunc {
1316
return func(ginCtx *gin.Context) {
1417
lang := commands.DefaultLanguage()
1518

1619
langHeader := ginCtx.GetHeader("Accept-Language")
20+
if strings.Count(langHeader, "-")+strings.Count(langHeader, "_") > maximumLanguageTags {
21+
langHeader = ""
22+
}
23+
1724
tags, _, err := language.ParseAcceptLanguage(langHeader)
1825
if err == nil && len(tags) > 0 {
1926
for _, tag := range tags {

0 commit comments

Comments
 (0)