diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index f33f7c71a..a95957a09 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -440,7 +440,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "83df1b82c014" + "Rev": "e83062b676e4" }, { "ImportPath": "k8s.io/apimachinery", @@ -460,7 +460,7 @@ }, { "ImportPath": "k8s.io/utils", - "Rev": "0bdb4ca86cbc" + "Rev": "d5654de09c73" }, { "ImportPath": "rsc.io/binaryregexp", diff --git a/go.mod b/go.mod index 5bcfa7548..7559731e5 100644 --- a/go.mod +++ b/go.mod @@ -26,15 +26,14 @@ require ( golang.org/x/net v0.0.0-20200707034311-ab3426394381 golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 golang.org/x/time v0.0.0-20191024005414-555d28b269f0 - k8s.io/api v0.0.0 - k8s.io/apimachinery v0.0.0 + k8s.io/api v0.0.0-20200731080027-e83062b676e4 + k8s.io/apimachinery v0.0.0-20200727091313-7efdc26a675c k8s.io/klog/v2 v2.2.0 k8s.io/utils v0.0.0-20200729134348-d5654de09c73 sigs.k8s.io/yaml v1.2.0 ) replace ( - k8s.io/api => ../api - k8s.io/apimachinery => ../apimachinery - k8s.io/client-go => ../client-go + k8s.io/api => k8s.io/api v0.0.0-20200731080027-e83062b676e4 + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200727091313-7efdc26a675c ) diff --git a/go.sum b/go.sum index 722b0c10b..4127e742c 100644 --- a/go.sum +++ b/go.sum @@ -334,6 +334,8 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +k8s.io/api v0.0.0-20200731080027-e83062b676e4/go.mod h1:6QwFoKNoXWMinlZZwHtDnpsr0l80pKtzo2w7kUsGqZE= +k8s.io/apimachinery v0.0.0-20200727091313-7efdc26a675c/go.mod h1:oE8UQU9DqIIc9PyIEYxTj/oJECzZLymCEU9dL0H4F+o= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0 h1:XRvcwJozkgZ1UQJmfMGpvRthQHOvihEhYtDfAaxMz/A= diff --git a/util/jsonpath/jsonpath_test.go b/util/jsonpath/jsonpath_test.go index 0c1bdb48d..e15c4097d 100644 --- a/util/jsonpath/jsonpath_test.go +++ b/util/jsonpath/jsonpath_test.go @@ -263,6 +263,8 @@ func TestStructInput(t *testing.T) { {"allarray", "{.Book[*].Author}", storeData, "Nigel Rees Evelyn Waugh Herman Melville", false}, {"allfields", `{range .Bicycle[*]}{ "{" }{ @.* }{ "} " }{end}`, storeData, "{red 19.95 true} {green 20.01 false} ", false}, {"recurfields", "{..Price}", storeData, "8.95 12.99 8.99 19.95 20.01", false}, + {"recurdotfields", "{...Price}", storeData, "8.95 12.99 8.99 19.95 20.01", false}, + {"superrecurfields", "{............................................................Price}", storeData, "", true}, {"allstructsSlice", "{.Bicycle}", storeData, `[{"Color":"red","Price":19.95,"IsNew":true},{"Color":"green","Price":20.01,"IsNew":false}]`, false}, {"allstructs", `{range .Bicycle[*]}{ @ }{ " " }{end}`, storeData, diff --git a/util/jsonpath/parser.go b/util/jsonpath/parser.go index e1aab6804..b84016a9f 100644 --- a/util/jsonpath/parser.go +++ b/util/jsonpath/parser.go @@ -214,8 +214,11 @@ func (p *Parser) parseIdentifier(cur *ListNode) error { return p.parseInsideAction(cur) } -// parseRecursive scans the recursive desent operator .. +// parseRecursive scans the recursive descent operator .. func (p *Parser) parseRecursive(cur *ListNode) error { + if lastIndex := len(cur.Nodes) - 1; lastIndex >= 0 && cur.Nodes[lastIndex].Type() == NodeRecursive { + return fmt.Errorf("invalid multiple recursive descent") + } p.pos += len("..") p.consumeText() cur.append(newRecursive()) diff --git a/util/jsonpath/parser_test.go b/util/jsonpath/parser_test.go index 2ec4677b9..96b112025 100644 --- a/util/jsonpath/parser_test.go +++ b/util/jsonpath/parser_test.go @@ -141,6 +141,7 @@ func TestFailParser(t *testing.T) { {"invalid number", "{+12.3.0}", "cannot parse number +12.3.0"}, {"unterminated array", "{[1}", "unterminated array"}, {"unterminated filter", "{[?(.price]}", "unterminated filter"}, + {"invalid multiple recursive descent", "{........}", "invalid multiple recursive descent"}, } for _, test := range failParserTests { _, err := Parse(test.name, test.text)