Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: shlex (#12347)
Danny Xu1d6b3707214f
diff --git a/backend/plugin/db/redis/redis.go b/backend/plugin/db/redis/redis.goindex 4ccb8102db..a0b77e9777 100644--- a/backend/plugin/db/redis/redis.go+++ b/backend/plugin/db/redis/redis.go@@ -12,6 +12,7 @@ import ("strings""time"+ "github.com/google/shlex""github.com/pkg/errors""github.com/redis/go-redis/v9""go.uber.org/multierr"@@ -153,7 +154,10 @@ func (d *Driver) Execute(ctx context.Context, statement string, opts db.ExecuteOlines := strings.Split(statement, "\n")if _, err := d.rdb.Pipelined(ctx, func(p redis.Pipeliner) error {for _, line := range lines {- fields := strings.Fields(line)+ fields, err := shlex.Split(line)+ if err != nil {+ return errors.Wrapf(err, "failed to split command %s", line)+ }if len(fields) == 0 {continue}@@ -192,7 +196,10 @@ func (d *Driver) QueryConn(ctx context.Context, _ *sql.Conn, statement string, qvar cmds []*redis.Cmdif _, err := d.rdb.Pipelined(ctx, func(p redis.Pipeliner) error {for _, line := range lines {- fields := strings.Fields(line)+ fields, err := shlex.Split(line)+ if err != nil {+ return errors.Wrapf(err, "failed to split command %s", line)+ }if len(fields) == 0 {continue}diff --git a/go.mod b/go.modindex b6ee473f1a..d31ba92965 100644--- a/go.mod+++ b/go.mod@@ -38,6 +38,7 @@ require (github.com/golang-jwt/jwt/v5 v5.2.1github.com/google/cel-go v0.20.1github.com/google/go-cmp v0.6.0+ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510github.com/google/uuid v1.6.0github.com/gorilla/websocket v1.5.1github.com/gosimple/slug v1.14.0diff --git a/go.sum b/go.sumindex ce911c548d..287b594ef7 100644--- a/go.sum+++ b/go.sum@@ -1179,6 +1179,8 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLegithub.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o=github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=+github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=+github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=