Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport fix for CVE-2024-53257 to release-18.0-github #132

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion go/vt/vtgate/debugenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import (
"html"
"net/http"
"strconv"
"text/template"
"time"

"github.com/google/safehtml/template"

"vitess.io/vitess/go/acl"
"vitess.io/vitess/go/vt/discovery"
"vitess.io/vitess/go/vt/log"
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/querylogz.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (
"net/http"
"strconv"
"strings"
"text/template"
"time"

"vitess.io/vitess/go/vt/vtgate/logstats"
"github.com/google/safehtml/template"

"vitess.io/vitess/go/acl"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/logz"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vtgate/logstats"
)

var (
Expand Down
8 changes: 4 additions & 4 deletions go/vt/vtgate/querylogz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

func TestQuerylogzHandlerFormatting(t *testing.T) {
req, _ := http.NewRequest("GET", "/querylogz?timeout=10&limit=1", nil)
logStats := logstats.NewLogStats(context.Background(), "Execute", "select name from test_table limit 1000", "suuid", nil)
logStats := logstats.NewLogStats(context.Background(), "Execute", "select name, 'inject <script>alert();</script>' from test_table limit 1000", "suuid", nil)
logStats.StmtType = "select"
logStats.RowsAffected = 1000
logStats.ShardQueries = 1
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestQuerylogzHandlerFormatting(t *testing.T) {
`<td>0.002</td>`,
`<td>0.003</td>`,
`<td>select</td>`,
`<td>select name from test_table limit 1000</td>`,
regexp.QuoteMeta(`<td>select name,​ &#39;inject &lt;script&gt;alert()​;&lt;/script&gt;&#39; from test_table limit 1000</td>`),
`<td>1</td>`,
`<td>1000</td>`,
`<td></td>`,
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestQuerylogzHandlerFormatting(t *testing.T) {
`<td>0.002</td>`,
`<td>0.003</td>`,
`<td>select</td>`,
`<td>select name from test_table limit 1000</td>`,
regexp.QuoteMeta(`<td>select name,​ &#39;inject &lt;script&gt;alert()​;&lt;/script&gt;&#39; from test_table limit 1000</td>`),
`<td>1</td>`,
`<td>1000</td>`,
`<td></td>`,
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestQuerylogzHandlerFormatting(t *testing.T) {
`<td>0.002</td>`,
`<td>0.003</td>`,
`<td>select</td>`,
`<td>select name from test_table limit 1000</td>`,
regexp.QuoteMeta(`<td>select name,​ &#39;inject &lt;script&gt;alert()​;&lt;/script&gt;&#39; from test_table limit 1000</td>`),
`<td>1</td>`,
`<td>1000</td>`,
`<td></td>`,
Expand Down
3 changes: 2 additions & 1 deletion go/vt/vttablet/tabletserver/debugenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import (
"html"
"net/http"
"strconv"
"text/template"
"time"

"github.com/google/safehtml/template"

"vitess.io/vitess/go/acl"
"vitess.io/vitess/go/vt/log"
)
Expand Down
3 changes: 2 additions & 1 deletion go/vt/vttablet/tabletserver/querylogz.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"net/http"
"strconv"
"strings"
"text/template"
"time"

"github.com/google/safehtml/template"

"vitess.io/vitess/go/acl"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/logz"
Expand Down
8 changes: 4 additions & 4 deletions go/vt/vttablet/tabletserver/querylogz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestQuerylogzHandler(t *testing.T) {
req, _ := http.NewRequest("GET", "/querylogz?timeout=10&limit=1", nil)
logStats := tabletenv.NewLogStats(context.Background(), "Execute")
logStats.PlanType = planbuilder.PlanSelect.String()
logStats.OriginalSQL = "select name from test_table limit 1000"
logStats.OriginalSQL = "select name, 'inject <script>alert();</script>' from test_table limit 1000"
logStats.RowsAffected = 1000
logStats.NumberOfQueries = 1
logStats.StartTime, _ = time.Parse("Jan 2 15:04:05", "Nov 29 13:33:09")
Expand All @@ -63,7 +63,7 @@ func TestQuerylogzHandler(t *testing.T) {
`<td>0.001</td>`,
`<td>1e-08</td>`,
`<td>Select</td>`,
`<td>select name from test_table limit 1000</td>`,
regexp.QuoteMeta(`<td>select name,​ &#39;inject &lt;script&gt;alert()​;&lt;/script&gt;&#39; from test_table limit 1000</td>`),
`<td>1</td>`,
`<td>none</td>`,
`<td>1000</td>`,
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestQuerylogzHandler(t *testing.T) {
`<td>0.001</td>`,
`<td>1e-08</td>`,
`<td>Select</td>`,
`<td>select name from test_table limit 1000</td>`,
regexp.QuoteMeta(`<td>select name,​ &#39;inject &lt;script&gt;alert()​;&lt;/script&gt;&#39; from test_table limit 1000</td>`),
`<td>1</td>`,
`<td>none</td>`,
`<td>1000</td>`,
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestQuerylogzHandler(t *testing.T) {
`<td>0.001</td>`,
`<td>1e-08</td>`,
`<td>Select</td>`,
`<td>select name from test_table limit 1000</td>`,
regexp.QuoteMeta(`<td>select name,​ &#39;inject &lt;script&gt;alert()​;&lt;/script&gt;&#39; from test_table limit 1000</td>`),
`<td>1</td>`,
`<td>none</td>`,
`<td>1000</td>`,
Expand Down
Loading