mirror of
https://github.com/kubernetes/client-go.git
synced 2026-07-01 14:35:35 +00:00
Merge pull request #93408 from joelsmith/master
jsonpath: disallow multiple immediate recursive descent Kubernetes-commit: c0ec2eee41794796dee230f75478602b707f2be2
This commit is contained in:
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@@ -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",
|
||||
|
||||
9
go.mod
9
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
|
||||
)
|
||||
|
||||
2
go.sum
2
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=
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user