diff --git a/go.mod b/go.mod index 081c250d..5411b341 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/prometheus/client_golang v1.19.1 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.55.0 - github.com/tidwall/gjson v1.17.1 + github.com/tidwall/gjson v1.18.0 go.uber.org/zap v1.27.0 golang.org/x/sync v0.7.0 google.golang.org/protobuf v1.34.2 diff --git a/go.sum b/go.sum index 1cb151d9..84cfe0d0 100644 --- a/go.sum +++ b/go.sum @@ -111,8 +111,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= -github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= diff --git a/vendor/github.com/gofiber/fiber/v2/LICENSE b/vendor/github.com/gofiber/fiber/v2/LICENSE index 5188bb8b..8f953f33 100644 --- a/vendor/github.com/gofiber/fiber/v2/LICENSE +++ b/vendor/github.com/gofiber/fiber/v2/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2019-present Fenny and Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2019-present Fenny and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/tidwall/gjson/README.md b/vendor/github.com/tidwall/gjson/README.md index 96b2e4dc..387766d5 100644 --- a/vendor/github.com/tidwall/gjson/README.md +++ b/vendor/github.com/tidwall/gjson/README.md @@ -1,7 +1,9 @@
-
+
@@ -436,15 +438,15 @@ Benchmarks of GJSON alongside [encoding/json](https://golang.org/pkg/encoding/js
and [json-iterator](https://github.com/json-iterator/go)
```
-BenchmarkGJSONGet-16 11644512 311 ns/op 0 B/op 0 allocs/op
-BenchmarkGJSONUnmarshalMap-16 1122678 3094 ns/op 1920 B/op 26 allocs/op
-BenchmarkJSONUnmarshalMap-16 516681 6810 ns/op 2944 B/op 69 allocs/op
-BenchmarkJSONUnmarshalStruct-16 697053 5400 ns/op 928 B/op 13 allocs/op
-BenchmarkJSONDecoder-16 330450 10217 ns/op 3845 B/op 160 allocs/op
-BenchmarkFFJSONLexer-16 1424979 2585 ns/op 880 B/op 8 allocs/op
-BenchmarkEasyJSONLexer-16 3000000 729 ns/op 501 B/op 5 allocs/op
-BenchmarkJSONParserGet-16 3000000 366 ns/op 21 B/op 0 allocs/op
-BenchmarkJSONIterator-16 3000000 869 ns/op 693 B/op 14 allocs/op
+BenchmarkGJSONGet-10 17893731 202.1 ns/op 0 B/op 0 allocs/op
+BenchmarkGJSONUnmarshalMap-10 1663548 2157 ns/op 1920 B/op 26 allocs/op
+BenchmarkJSONUnmarshalMap-10 832236 4279 ns/op 2920 B/op 68 allocs/op
+BenchmarkJSONUnmarshalStruct-10 1076475 3219 ns/op 920 B/op 12 allocs/op
+BenchmarkJSONDecoder-10 585729 6126 ns/op 3845 B/op 160 allocs/op
+BenchmarkFFJSONLexer-10 2508573 1391 ns/op 880 B/op 8 allocs/op
+BenchmarkEasyJSONLexer-10 3000000 537.9 ns/op 501 B/op 5 allocs/op
+BenchmarkJSONParserGet-10 13707510 263.9 ns/op 21 B/op 0 allocs/op
+BenchmarkJSONIterator-10 3000000 561.2 ns/op 693 B/op 14 allocs/op
```
JSON document used:
@@ -485,4 +487,6 @@ widget.image.hOffset
widget.text.onMouseUp
```
-*These benchmarks were run on a MacBook Pro 16" 2.4 GHz Intel Core i9 using Go 1.17 and can be found [here](https://github.com/tidwall/gjson-benchmarks).*
+**
+
+*These benchmarks were run on a MacBook Pro M1 Max using Go 1.22 and can be found [here](https://github.com/tidwall/gjson-benchmarks).*
diff --git a/vendor/github.com/tidwall/gjson/SYNTAX.md b/vendor/github.com/tidwall/gjson/SYNTAX.md
index 6721d7f5..a3f0fac2 100644
--- a/vendor/github.com/tidwall/gjson/SYNTAX.md
+++ b/vendor/github.com/tidwall/gjson/SYNTAX.md
@@ -1,6 +1,6 @@
# GJSON Path Syntax
-A GJSON Path is a text string syntax that describes a search pattern for quickly retreiving values from a JSON payload.
+A GJSON Path is a text string syntax that describes a search pattern for quickly retrieving values from a JSON payload.
This document is designed to explain the structure of a GJSON Path through examples.
@@ -15,12 +15,12 @@ This document is designed to explain the structure of a GJSON Path through examp
- [Multipaths](#multipaths)
- [Literals](#literals)
-The definitive implemenation is [github.com/tidwall/gjson](https://github.com/tidwall/gjson).
+The definitive implementation is [github.com/tidwall/gjson](https://github.com/tidwall/gjson).
Use the [GJSON Playground](https://gjson.dev) to experiment with the syntax online.
## Path structure
-A GJSON Path is intended to be easily expressed as a series of components seperated by a `.` character.
+A GJSON Path is intended to be easily expressed as a series of components separated by a `.` character.
Along with `.` character, there are a few more that have special meaning, including `|`, `#`, `@`, `\`, `*`, `!`, and `?`.
@@ -46,7 +46,7 @@ The following GJSON Paths evaluate to the accompanying values.
### Basic
-In many cases you'll just want to retreive values by object name or array index.
+In many cases you'll just want to retrieve values by object name or array index.
```go
name.last "Anderson"
diff --git a/vendor/github.com/tidwall/gjson/gjson.go b/vendor/github.com/tidwall/gjson/gjson.go
index 4acd087c..5aa2a4ff 100644
--- a/vendor/github.com/tidwall/gjson/gjson.go
+++ b/vendor/github.com/tidwall/gjson/gjson.go
@@ -1040,6 +1040,10 @@ func parseObjectPath(path string) (r objectPathResult) {
return
}
+var vchars = [256]byte{
+ '"': 2, '{': 3, '(': 3, '[': 3, '}': 1, ')': 1, ']': 1,
+}
+
func parseSquash(json string, i int) (int, string) {
// expects that the lead character is a '[' or '{' or '('
// squash the value, ignoring all nested arrays and objects.
@@ -1047,43 +1051,137 @@ func parseSquash(json string, i int) (int, string) {
s := i
i++
depth := 1
- for ; i < len(json); i++ {
- if json[i] >= '"' && json[i] <= '}' {
- switch json[i] {
- case '"':
+ var c byte
+ for i < len(json) {
+ for i < len(json)-8 {
+ jslice := json[i : i+8]
+ c = vchars[jslice[0]]
+ if c != 0 {
+ i += 0
+ goto token
+ }
+ c = vchars[jslice[1]]
+ if c != 0 {
+ i += 1
+ goto token
+ }
+ c = vchars[jslice[2]]
+ if c != 0 {
+ i += 2
+ goto token
+ }
+ c = vchars[jslice[3]]
+ if c != 0 {
+ i += 3
+ goto token
+ }
+ c = vchars[jslice[4]]
+ if c != 0 {
+ i += 4
+ goto token
+ }
+ c = vchars[jslice[5]]
+ if c != 0 {
+ i += 5
+ goto token
+ }
+ c = vchars[jslice[6]]
+ if c != 0 {
+ i += 6
+ goto token
+ }
+ c = vchars[jslice[7]]
+ if c != 0 {
+ i += 7
+ goto token
+ }
+ i += 8
+ }
+ c = vchars[json[i]]
+ if c == 0 {
+ i++
+ continue
+ }
+ token:
+ if c == 2 {
+ // '"' string
+ i++
+ s2 := i
+ nextquote:
+ for i < len(json)-8 {
+ jslice := json[i : i+8]
+ if jslice[0] == '"' {
+ i += 0
+ goto strchkesc
+ }
+ if jslice[1] == '"' {
+ i += 1
+ goto strchkesc
+ }
+ if jslice[2] == '"' {
+ i += 2
+ goto strchkesc
+ }
+ if jslice[3] == '"' {
+ i += 3
+ goto strchkesc
+ }
+ if jslice[4] == '"' {
+ i += 4
+ goto strchkesc
+ }
+ if jslice[5] == '"' {
+ i += 5
+ goto strchkesc
+ }
+ if jslice[6] == '"' {
+ i += 6
+ goto strchkesc
+ }
+ if jslice[7] == '"' {
+ i += 7
+ goto strchkesc
+ }
+ i += 8
+ }
+ goto strchkstd
+ strchkesc:
+ if json[i-1] != '\\' {
i++
- s2 := i
- for ; i < len(json); i++ {
- if json[i] > '\\' {
- continue
- }
- if json[i] == '"' {
- // look for an escaped slash
- if json[i-1] == '\\' {
- n := 0
- for j := i - 2; j > s2-1; j-- {
- if json[j] != '\\' {
- break
- }
- n++
- }
- if n%2 == 0 {
- continue
- }
+ continue
+ }
+ strchkstd:
+ for i < len(json) {
+ if json[i] > '\\' || json[i] != '"' {
+ i++
+ continue
+ }
+ // look for an escaped slash
+ if json[i-1] == '\\' {
+ n := 0
+ for j := i - 2; j > s2-1; j-- {
+ if json[j] != '\\' {
+ break
}
- break
+ n++
+ }
+ if n%2 == 0 {
+ i++
+ goto nextquote
}
}
- case '{', '[', '(':
- depth++
- case '}', ']', ')':
- depth--
- if depth == 0 {
- i++
- return i, json[s:i]
- }
+ break
+ }
+ } else {
+ // '{', '[', '(', '}', ']', ')'
+ // open close tokens
+ depth += int(c) - 2
+ if depth == 0 {
+ i++
+ return i, json[s:i]
}
}
+ i++
}
return i, json[s:]
}
@@ -1252,7 +1350,7 @@ func parseObject(c *parseContext, i int, path string) (int, bool) {
}
// matchLimit will limit the complexity of the match operation to avoid ReDos
-// attacks from arbritary inputs.
+// attacks from arbitrary inputs.
// See the github.com/tidwall/match.MatchLimit function for more information.
func matchLimit(str, pattern string) bool {
matched, _ := match.MatchLimit(str, pattern, 10000)
@@ -1917,6 +2015,16 @@ func appendHex16(dst []byte, x uint16) []byte {
)
}
+// DisableEscapeHTML will disable the automatic escaping of certain
+// "problamatic" HTML characters when encoding to JSON.
+// These character include '>', '<' and '&', which get escaped to \u003e,
+// \u0026, and \u003c respectively.
+//
+// This is a global flag and will affect all further gjson operations.
+// Ideally, if used, it should be set one time before other gjson functions
+// are called.
+var DisableEscapeHTML = false
+
// AppendJSONString is a convenience function that converts the provided string
// to a valid JSON string and appends it to dst.
func AppendJSONString(dst []byte, s string) []byte {
@@ -1940,7 +2048,8 @@ func AppendJSONString(dst []byte, s string) []byte {
dst = append(dst, 'u')
dst = appendHex16(dst, uint16(s[i]))
}
- } else if s[i] == '>' || s[i] == '<' || s[i] == '&' {
+ } else if !DisableEscapeHTML &&
+ (s[i] == '>' || s[i] == '<' || s[i] == '&') {
dst = append(dst, '\\', 'u')
dst = appendHex16(dst, uint16(s[i]))
} else if s[i] == '\\' {
@@ -2194,7 +2303,7 @@ func unescape(json string) string {
}
// Less return true if a token is less than another token.
-// The caseSensitive paramater is used when the tokens are Strings.
+// The caseSensitive parameter is used when the tokens are Strings.
// The order when comparing two different type is:
//
// Null < False < Number < String < True < JSON
@@ -3353,7 +3462,7 @@ func (t Result) Path(json string) string {
goto fail
}
if !strings.HasPrefix(json[t.Index:], t.Raw) {
- // Result is not at the JSON index as exepcted.
+ // Result is not at the JSON index as expected.
goto fail
}
for ; i >= 0; i-- {
diff --git a/vendor/github.com/tidwall/gjson/logo.png b/vendor/github.com/tidwall/gjson/logo.png
deleted file mode 100644
index 17a8bbe9..00000000
Binary files a/vendor/github.com/tidwall/gjson/logo.png and /dev/null differ
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 778c5cbb..475dce22 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -147,7 +147,7 @@ github.com/rivo/uniseg
# github.com/spf13/pflag v1.0.5
## explicit; go 1.12
github.com/spf13/pflag
-# github.com/tidwall/gjson v1.17.1
+# github.com/tidwall/gjson v1.18.0
## explicit; go 1.12
github.com/tidwall/gjson
# github.com/tidwall/match v1.1.1