diff --git a/README.md b/README.md index 568d65f..a2dbbc5 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Let's make the catalog better, check our [contribution](./CONTRIBUTING.md) guide ## License - Copyright 2020 Napptive + Copyright 2023 Napptive Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/catalog-manager/commands/admin.go b/cmd/catalog-manager/commands/admin.go index 68e4038..ed05553 100644 --- a/cmd/catalog-manager/commands/admin.go +++ b/cmd/catalog-manager/commands/admin.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package commands import ( diff --git a/cmd/catalog-manager/commands/cli.go b/cmd/catalog-manager/commands/cli.go index 43dc0a3..97d00fd 100644 --- a/cmd/catalog-manager/commands/cli.go +++ b/cmd/catalog-manager/commands/cli.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cmd/catalog-manager/commands/root.go b/cmd/catalog-manager/commands/root.go index d2c701f..128a2a2 100644 --- a/cmd/catalog-manager/commands/root.go +++ b/cmd/catalog-manager/commands/root.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ import ( "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "github.com/spf13/cobra" ) diff --git a/cmd/catalog-manager/commands/run.go b/cmd/catalog-manager/commands/run.go index 57be5b3..0ac23b0 100644 --- a/cmd/catalog-manager/commands/run.go +++ b/cmd/catalog-manager/commands/run.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package commands import ( "time" - catalog_manager "github.com/napptive/catalog-manager/internal/app/catalog-manager" + "github.com/napptive/catalog-manager/internal/app/catalog-manager" "github.com/spf13/cobra" ) diff --git a/cmd/catalog-manager/main.go b/cmd/catalog-manager/main.go index 5c73862..4f45d0e 100644 --- a/cmd/catalog-manager/main.go +++ b/cmd/catalog-manager/main.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package main import ( diff --git a/docker/catalog-manager/Dockerfile b/docker/catalog-manager/Dockerfile index d8edd65..da4cdff 100644 --- a/docker/catalog-manager/Dockerfile +++ b/docker/catalog-manager/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.16.2 +FROM alpine:3.18.5 WORKDIR /app diff --git a/go.mod b/go.mod index 3dd3063..0a5fdb0 100644 --- a/go.mod +++ b/go.mod @@ -1,46 +1,46 @@ module github.com/napptive/catalog-manager -go 1.19 +go 1.21 require ( - github.com/doug-martin/goqu/v9 v9.18.0 + github.com/doug-martin/goqu/v9 v9.19.0 github.com/elastic/go-elasticsearch/v7 v7.17.10 github.com/golang/mock v1.6.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.1 github.com/napptive/analytics v1.1.0 github.com/napptive/grpc-catalog-common-go v0.2.0 github.com/napptive/grpc-catalog-go v0.28.0 github.com/napptive/grpc-jwt-go v0.1.0 - github.com/napptive/grpc-playground-apps-go v0.34.0 + github.com/napptive/grpc-playground-apps-go v0.45.0 github.com/napptive/mock-extensions v1.0.0 github.com/napptive/nerrors v1.1.0 - github.com/napptive/njwt v1.8.0 + github.com/napptive/njwt v1.8.1-0.20240119105957-cd28e5a47f2f github.com/napptive/oam-utils v1.0.0 github.com/napptive/rdbms/v2 v2.4.0 github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.27.8 + github.com/onsi/gomega v1.30.0 github.com/rs/xid v1.5.0 - github.com/rs/zerolog v1.29.1 - github.com/spf13/cobra v1.7.0 - golang.org/x/crypto v0.10.0 - golang.org/x/net v0.11.0 - google.golang.org/grpc v1.56.0 - k8s.io/apimachinery v0.27.3 - sigs.k8s.io/yaml v1.3.0 + github.com/rs/zerolog v1.31.0 + github.com/spf13/cobra v1.8.0 + golang.org/x/crypto v0.16.0 + golang.org/x/net v0.17.0 + google.golang.org/grpc v1.59.0 + k8s.io/apimachinery v0.28.2 + sigs.k8s.io/yaml v1.4.0 syreclabs.com/go/faker v1.2.3 ) require ( - cloud.google.com/go v0.110.0 // indirect - cloud.google.com/go/bigquery v1.50.0 // indirect - cloud.google.com/go/compute v1.19.1 // indirect + cloud.google.com/go v0.110.8 // indirect + cloud.google.com/go/bigquery v1.55.0 // indirect + cloud.google.com/go/compute v1.23.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v0.13.0 // indirect + cloud.google.com/go/iam v1.1.2 // indirect github.com/andybalholm/brotli v1.0.5 // indirect - github.com/apache/arrow/go/v11 v11.0.0 // indirect + github.com/apache/arrow/go/v12 v12.0.0 // indirect github.com/apache/thrift v0.18.1 // indirect - github.com/envoyproxy/protoc-gen-validate v0.10.1 // indirect + github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect @@ -52,11 +52,12 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/flatbuffers v23.3.3+incompatible // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.8.0 // indirect + github.com/google/s2a-go v0.1.5 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.14.0 // indirect @@ -72,39 +73,39 @@ require ( github.com/klauspost/compress v1.16.3 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/napptive/grpc-common-go v0.8.0 // indirect github.com/napptive/grpc-playground-common-go v0.6.0 // indirect - github.com/napptive/grpc-playground-environments-go v0.11.0 // indirect + github.com/napptive/grpc-playground-environments-go v0.17.0 // indirect github.com/napptive/grpc-playground-oam3-go v0.5.0 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/mod v0.10.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect - golang.org/x/tools v0.9.1 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/oauth2 v0.11.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.12.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.114.0 // indirect + google.golang.org/api v0.134.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/klog/v2 v2.90.1 // indirect - k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 // indirect + k8s.io/klog/v2 v2.100.1 // indirect + k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/go.sum b/go.sum index 6966222..730609f 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+Y cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= +cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= +cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -35,19 +35,21 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigquery v1.25.0/go.mod h1:4WtqW7wUNz7dklHMg62ST1k97dQrsnZN5iCeZYrIsC8= -cloud.google.com/go/bigquery v1.50.0 h1:RscMV6LbnAmhAzD893Lv9nXXy2WCaJmbxYPWDLbGqNQ= -cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU= -cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= -cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= +cloud.google.com/go/bigquery v1.55.0 h1:hs44Xxov3XLWQiCx2J8lK5U/ihLqnpm4RVVl5fdtLLI= +cloud.google.com/go/bigquery v1.55.0/go.mod h1:9Y5I3PN9kQWuid6183JFhOGOW3GcirA5LpsKCUn+2ec= +cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= +cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datacatalog v1.0.0/go.mod h1:cz8rXsZV278v0nXPhnp5eXRnZtqx2Mtv96W8r7a7Oxs= -cloud.google.com/go/datacatalog v1.13.0 h1:4H5IJiyUE0X6ShQBqgFFZvGGcrwGVndTwUSLP4c52gw= +cloud.google.com/go/datacatalog v1.16.0 h1:qVeQcw1Cz93/cGu2E7TYUPh8Lz5dn5Ws2siIuQ17Vng= +cloud.google.com/go/datacatalog v1.16.0/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= +cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= +cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/longrunning v0.5.1 h1:Fr7TXftcqTudoyRJa113hyaqlGdiBQkp0Gq7tErFDWI= +cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -58,13 +60,15 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.18.2/go.mod h1:AiIj7BWXyhO5gGVmYJ+S8tbkCx3yb0IMjua8Aw4naVM= -cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= +cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c h1:RGWPOewvKIROun94nF7v2cua9qP+thov/7M50KEoeSU= +github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -73,8 +77,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdko github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/v11 v11.0.0 h1:hqauxvFQxww+0mEU/2XHG6LT7eZternCZq+A5Yly2uM= -github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI= +github.com/apache/arrow/go/v12 v12.0.0 h1:xtZE63VWl7qLdB0JObIXvvhGjoVNrQ9ciIHG2OK5cmc= +github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg= github.com/apache/thrift v0.18.1 h1:lNhK/1nqjbwbiOPDBPFJVKxgDEGSepKuTh6OLiXW8kg= github.com/apache/thrift v0.18.1/go.mod h1:rdQn/dCcDKEWjjylUeueum4vQEjG2v8v2PqriUnbr+I= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= @@ -104,7 +108,7 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -112,8 +116,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/doug-martin/goqu/v9 v9.18.0 h1:/6bcuEtAe6nsSMVK/M+fOiXUNfyFF3yYtE07DBPFMYY= -github.com/doug-martin/goqu/v9 v9.18.0/go.mod h1:nf0Wc2/hV3gYK9LiyqIrzBEVGlI8qW3GuDCEobC4wBQ= +github.com/doug-martin/goqu/v9 v9.19.0 h1:PD7t1X3tRcUiSdc5TEyOFKujZA5gs3VSA7wxSvBx7qo= +github.com/doug-martin/goqu/v9 v9.19.0/go.mod h1:nf0Wc2/hV3gYK9LiyqIrzBEVGlI8qW3GuDCEobC4wBQ= github.com/elastic/go-elasticsearch/v7 v7.17.10 h1:TCQ8i4PmIJuBunvBS6bwT2ybzVFxxUhhltAs3Gyu1yo= github.com/elastic/go-elasticsearch/v7 v7.17.10/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= @@ -129,8 +133,8 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= -github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= -github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -171,7 +175,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -226,8 +231,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -238,6 +244,7 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -255,24 +262,26 @@ github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.5 h1:8IYp3w9nysqv3JH+NJgXJzGbDHzLOTj43BmSkp+O7qg= +github.com/google/s2a-go v0.1.5/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= +github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/googleapis/gax-go/v2 v2.8.0 h1:UBtEZqx1bjXtOQ5BVTkuYghXrr3N4V123VKJK67vJZc= -github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.1 h1:RoziI+96HlQWrbaVhgOOdFYUHtX81pwA6tCgDS9FNRo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.1/go.mod h1:Rj8lEaVgLiPn1jTMVXEhATiZhuyXJq167bMYPbJM1CY= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -355,6 +364,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -379,8 +389,8 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= -github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= @@ -409,20 +419,20 @@ github.com/napptive/grpc-jwt-go v0.1.0 h1:QNeoE02toYIeg1fgA1kLZ2sceIojvkLX2ilcdS github.com/napptive/grpc-jwt-go v0.1.0/go.mod h1:72jubWbV00k6AjHzZ0OtRjcW54d+btSu5VegoQQ7h0o= github.com/napptive/grpc-ping-go v0.1.0 h1:/hNDGXAOPbGA/jszauggfDG3PcVsfpgrxrS5lLGgfwI= github.com/napptive/grpc-ping-go v0.1.0/go.mod h1:hBIdzClG9sZCHcq+tYZGNLaZ0TtQZ6s/YIRbNyhKES4= -github.com/napptive/grpc-playground-apps-go v0.34.0 h1:mSsVWz4n9vWs6QrMqkCVTA9W5HWU3Rjcqk/fR32Im8w= -github.com/napptive/grpc-playground-apps-go v0.34.0/go.mod h1:0U/uXuVz7u9nRNXFTBnvVv4JY/+cY4I4bWzEm/tbeeA= +github.com/napptive/grpc-playground-apps-go v0.45.0 h1:rz39mUsoDRpXhSKhP8+DYpOXNCgGhv/1fglbsn594DM= +github.com/napptive/grpc-playground-apps-go v0.45.0/go.mod h1:0U/uXuVz7u9nRNXFTBnvVv4JY/+cY4I4bWzEm/tbeeA= github.com/napptive/grpc-playground-common-go v0.6.0 h1:TQDS1qy6c1O6Bb1M3Rt0FW94/2l3lrDmozoHEEvCPNw= github.com/napptive/grpc-playground-common-go v0.6.0/go.mod h1:foiyt6GxEG8T10a7QpuJk/iUcKKFbk1v/9vqyfx7vqw= -github.com/napptive/grpc-playground-environments-go v0.11.0 h1:MiGB/w8Vd/z1P7jv19/RJbVp4vaPjyE2rddwXrpIwAU= -github.com/napptive/grpc-playground-environments-go v0.11.0/go.mod h1:F0VkGV3lP1+tt647ZIMswjmPCRUb//5FrzIG87gxgt4= +github.com/napptive/grpc-playground-environments-go v0.17.0 h1:232/aOcM0HugyZzSS3H2rsGjtQ3j4/1lEL9UhJpVfyE= +github.com/napptive/grpc-playground-environments-go v0.17.0/go.mod h1:F0VkGV3lP1+tt647ZIMswjmPCRUb//5FrzIG87gxgt4= github.com/napptive/grpc-playground-oam3-go v0.5.0 h1:5C0w+36dOTTKOLhQSLAXwrC65dQHIYXMXv7acV0UmRI= github.com/napptive/grpc-playground-oam3-go v0.5.0/go.mod h1:yx8PErFNTfjgFVyOYF3bFq9sxJZiY/Z08uYokIvYJdQ= github.com/napptive/mock-extensions v1.0.0 h1:gesBQWNBWZ/mfyQbX3G5DLRDcnNOEQL2dncUa4E1TaI= github.com/napptive/mock-extensions v1.0.0/go.mod h1:RL9B37bA5Y08gw4bffhtedE+zFRqj3uHshLuP2lhhyA= github.com/napptive/nerrors v1.1.0 h1:TkpfHi5CScDlzC4uKKiOj3wTJ//zW7Zx8uXukMbCHdA= github.com/napptive/nerrors v1.1.0/go.mod h1:CpRat1XjEuYtPjsQ7w2qZeOgYz+Ok5KdMipAWpISYgg= -github.com/napptive/njwt v1.8.0 h1:mx66P6VEUNK9qfKoy4wQnYuoG4mQAhFyWn8hYqo0NkM= -github.com/napptive/njwt v1.8.0/go.mod h1:fKQErIBWlN//xu3Ltw2X+/AdV69t4wyZUgwlGmzFoUs= +github.com/napptive/njwt v1.8.1-0.20240119105957-cd28e5a47f2f h1:wgooOmc13PfKXWNutXwvWWgEJ1U4B5jXZCco15i6IHM= +github.com/napptive/njwt v1.8.1-0.20240119105957-cd28e5a47f2f/go.mod h1:bx6SPBi3DmSViUu7vRlSgv8ziuyioGmDid8NwyQvZLQ= github.com/napptive/oam-utils v1.0.0 h1:OID39Qyb1QkAVyJp4KdsrgmGpZv/WvXjLWkJzKc4DMQ= github.com/napptive/oam-utils v1.0.0/go.mod h1:eGN0/sYZM0I+kkn8+2LiGwj7Tg35vwih44v+5pSCzR4= github.com/napptive/rdbms/v2 v2.4.0 h1:OeC5jJCp5XPJfgDQclOeQ3sR6LURjh/gb9cYtuFWYIo= @@ -440,14 +450,15 @@ github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= +github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= +github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= @@ -460,7 +471,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -471,8 +483,8 @@ github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThC github.com/rs/zerolog v1.26.0/go.mod h1:yBiM87lvSqX8h0Ww4sdzNSkVYZ8dL2xjZJG1lAuGZEo= github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= @@ -485,8 +497,8 @@ github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTd github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= @@ -504,8 +516,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -515,6 +528,7 @@ github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= @@ -556,10 +570,11 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -571,6 +586,7 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 h1:tnebWN09GYg9OLPss1KXj8txwZc6X6uMr6VFdcGNbHw= +golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -599,8 +615,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -650,8 +666,8 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -669,8 +685,8 @@ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -683,8 +699,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -763,8 +779,9 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -778,9 +795,10 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -848,8 +866,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= +golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -859,6 +877,7 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= +gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -892,8 +911,8 @@ google.golang.org/api v0.58.0/go.mod h1:cAbP2FsxoGVNwtgNAmmn3y5G1TWAiVYRmg4yku3l google.golang.org/api v0.60.0/go.mod h1:d7rl65NZAkEQ90JFzqBjcRq1TVeG5ZoGV3sSpEnnVb4= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.114.0 h1:1xQPji6cO2E2vLiI+C/XiFAnsn1WV3mjaEwGLhi3grE= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= +google.golang.org/api v0.134.0 h1:ktL4Goua+UBgoP1eL1/60LwZJqa1sIzkLmvoR3hR6Gw= +google.golang.org/api v0.134.0/go.mod h1:sjRL3UnjTx5UqNQS9EWr9N8p7xbHpy1k0XGRLCf3Spk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -968,12 +987,12 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1001,9 +1020,10 @@ google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1019,8 +1039,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1054,19 +1074,19 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= -k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM= -k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/apimachinery v0.28.2 h1:KCOJLrc6gu+wV1BYgwik4AF4vXOlVJPdiqn0yAWWwXQ= +k8s.io/apimachinery v0.28.2/go.mod h1:RdzF87y/ngqk9H4z3EL2Rppv5jj95vGS/HaFXrLDApU= k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= -k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= +k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 h1:xMMXJlJbsU8w3V5N2FLDQ8YgU8s1EoULdbQBcAeNJkY= -k8s.io/utils v0.0.0-20230313181309-38a27ef9d749/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= @@ -1076,7 +1096,7 @@ sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h6 sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= syreclabs.com/go/faker v1.2.3 h1:HPrWtnHazIf0/bVuPZJLFrtHlBHk10hS0SB+mV8v6R4= syreclabs.com/go/faker v1.2.3/go.mod h1:NAXInmkPsC2xuO5MKZFe80PUXX5LU8cFdJIHGs+nSBE= diff --git a/internal/app/catalog-manager/service.go b/internal/app/catalog-manager/service.go index 5b514e2..5b3eb1a 100644 --- a/internal/app/catalog-manager/service.go +++ b/internal/app/catalog-manager/service.go @@ -26,15 +26,16 @@ import ( "syscall" "time" - grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" + grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" bqinterceptor "github.com/napptive/analytics/pkg/interceptors" "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/napptive/catalog-manager/internal/pkg/server/admin" "github.com/napptive/catalog-manager/internal/pkg/server/apps" - catalog_manager "github.com/napptive/catalog-manager/internal/pkg/server/catalog-manager" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" - grpc_jwt_go "github.com/napptive/grpc-jwt-go" + "github.com/napptive/catalog-manager/internal/pkg/server/catalog-manager" + "github.com/napptive/catalog-manager/internal/pkg/server/resolver" + "github.com/napptive/grpc-catalog-go" + "github.com/napptive/grpc-jwt-go" "github.com/napptive/nerrors/pkg/nerrors" njwtConfig "github.com/napptive/njwt/pkg/config" "github.com/napptive/njwt/pkg/interceptors" @@ -121,7 +122,7 @@ func (s *Service) createInterceptors(providers *Providers, JWTSecretsClient grpc var unaryStreamChain []grpc.StreamServerInterceptor if s.cfg.AuthEnabled { - config := njwtConfig.JWTConfig{ + catalogConfig := njwtConfig.JWTConfig{ Secret: s.cfg.JWTConfig.Secret, Header: s.cfg.JWTConfig.Header, } @@ -130,13 +131,13 @@ func (s *Service) createInterceptors(providers *Providers, JWTSecretsClient grpc if s.cfg.CatalogManager.UseZoneAwareInterceptors { log.Info().Msg("using zone-aware interceptor") - secretProvider := interceptors.NewInterceptorZoneSecretManager(config, JWTSecretsClient, ZoneSecretCacheTTL) - jwtInterceptor = interceptors.ZoneAwareJWTInterceptor(config, secretProvider) - jwtStreamingInterceptor = interceptors.ZoneAwareJWTStreamInterceptor(config, secretProvider) + secretProvider := interceptors.NewInterceptorZoneSecretManager(catalogConfig, JWTSecretsClient, ZoneSecretCacheTTL) + jwtInterceptor = interceptors.ZoneAwareJWTInterceptor(catalogConfig, secretProvider) + jwtStreamingInterceptor = interceptors.ZoneAwareJWTStreamInterceptor(catalogConfig, secretProvider) } else { log.Info().Msg("using standard JWT interceptor") - jwtInterceptor = interceptors.JwtInterceptor(config) - jwtStreamingInterceptor = interceptors.JwtStreamInterceptor(config) + jwtInterceptor = interceptors.JwtInterceptor(catalogConfig) + jwtStreamingInterceptor = interceptors.JwtStreamInterceptor(catalogConfig) } unaryInterceptorsChain = append(unaryInterceptorsChain, jwtInterceptor) unaryStreamChain = append(unaryStreamChain, jwtStreamingInterceptor) @@ -148,17 +149,20 @@ func (s *Service) createInterceptors(providers *Providers, JWTSecretsClient grpc unaryStreamChain = append(unaryStreamChain, bqinterceptor.OpStreamInterceptor(providers.analyticsProvider)) } - return grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(unaryInterceptorsChain...)), + return grpc.UnaryInterceptor(grpcmiddleware.ChainUnaryServer(unaryInterceptorsChain...)), grpc.ChainStreamInterceptor(unaryStreamChain...) } // LaunchGRPCService launches a server for gRPC requests. func (s *Service) LaunchGRPCService(providers *Providers, clients *Clients) { + + permissionResolver := resolver.NewPermissionResolver(s.cfg.AuthEnabled, s.cfg.TeamConfig) + manager := catalog_manager.NewManager(providers.repoStorage, providers.elasticProvider, s.cfg.CatalogUrl) - handler := catalog_manager.NewHandler(manager, s.cfg.AuthEnabled, s.cfg.TeamConfig) + handler := catalog_manager.NewHandler(manager, s.cfg.AuthEnabled, s.cfg.TeamConfig, *permissionResolver) appManager := apps.NewManager(&s.cfg, manager) - appHandler := apps.NewHandler(&s.cfg.JWTConfig, appManager) + appHandler := apps.NewHandler(&s.cfg.JWTConfig, appManager, *permissionResolver) unaryInterceptors, streamingInterceptors := s.createInterceptors(providers, clients.JWTSecretsClient) @@ -190,7 +194,7 @@ func (s *Service) LaunchGRPCService(providers *Providers, clients *Clients) { } // HealthzHandler to return 200 if called. -func (s *Service) HealthzHandler(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { +func (s *Service) HealthzHandler(w http.ResponseWriter, _ *http.Request, pathParams map[string]string) { w.WriteHeader(http.StatusOK) } @@ -260,7 +264,7 @@ func (s *Service) registerShutdownListener(providers *Providers) { func (s *Service) Shutdown(providers *Providers) { log.Warn().Msg("shutting down service") if s.cfg.BQConfig.Enabled { - providers.analyticsProvider.Flush() + _ = providers.analyticsProvider.Flush() } } diff --git a/internal/app/cli/admin.go b/internal/app/cli/admin.go index 4e1b8bb..41ee3b6 100644 --- a/internal/app/cli/admin.go +++ b/internal/app/cli/admin.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import ( "strings" "time" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" + "github.com/napptive/grpc-catalog-go" "github.com/napptive/nerrors/pkg/nerrors" "github.com/rs/zerolog/log" "golang.org/x/net/context" diff --git a/internal/app/cli/helpers.go b/internal/app/cli/helpers.go index 78974d3..6b05ec6 100644 --- a/internal/app/cli/helpers.go +++ b/internal/app/cli/helpers.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package cli import ( "fmt" - "github.com/napptive/catalog-manager/internal/pkg/printer" + "github.com/napptive/catalog-manager/internal/pkg/printer" "github.com/napptive/nerrors/pkg/nerrors" "github.com/rs/zerolog" ) diff --git a/internal/app/cli/user.go b/internal/app/cli/user.go index 2f17032..6cdcdb9 100644 --- a/internal/app/cli/user.go +++ b/internal/app/cli/user.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package cli import ( "fmt" + "github.com/napptive/catalog-manager/internal/pkg/server/users" "github.com/napptive/nerrors/pkg/nerrors" ) diff --git a/internal/pkg/config/bq_config.go b/internal/pkg/config/bq_config.go index d6a376a..1e31d0e 100644 --- a/internal/pkg/config/bq_config.go +++ b/internal/pkg/config/bq_config.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package config import bqconfig "github.com/napptive/analytics/pkg/config" diff --git a/internal/pkg/config/catalog_manager.go b/internal/pkg/config/catalog_manager.go index 32b8915..7119033 100644 --- a/internal/pkg/config/catalog_manager.go +++ b/internal/pkg/config/catalog_manager.go @@ -63,19 +63,16 @@ func (c *CatalogManager) IsValid() error { if c.RepositoryPath == "" { return nerrors.NewFailedPreconditionError("RepositoryPath must be filled") } - if c.AdminAPI { if c.AdminGRPCPort <= 0 { return nerrors.NewFailedPreconditionError("invalid admin gRPC port number") } } - if c.UseZoneAwareInterceptors { if c.SecretsProviderAddress == "" { return nerrors.NewFailedPreconditionError("secretsProviderAddress must be set") } } - return nil } diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 8ee549a..be17592 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/config/config_suite_test.go b/internal/pkg/config/config_suite_test.go index 600eefa..075210f 100644 --- a/internal/pkg/config/config_suite_test.go +++ b/internal/pkg/config/config_suite_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/config/config_test.go b/internal/pkg/config/config_test.go index 9a75941..002cb22 100644 --- a/internal/pkg/config/config_test.go +++ b/internal/pkg/config/config_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/config/jwtconfig.go b/internal/pkg/config/jwtconfig.go index d7a1615..25b4bf4 100644 --- a/internal/pkg/config/jwtconfig.go +++ b/internal/pkg/config/jwtconfig.go @@ -23,7 +23,7 @@ func (c *JWTConfig) IsValid() error { return nil } -// IsValid checks if the configuration options are valid. +// Print prints the configuration func (c *JWTConfig) Print() error { if c.AuthEnabled { log.Info().Str("header", c.Header). diff --git a/internal/pkg/config/sql.go b/internal/pkg/config/sql.go index 5aabb2e..f5239c0 100644 --- a/internal/pkg/config/sql.go +++ b/internal/pkg/config/sql.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package config // UserSQL contains all the configuration to connect to database diff --git a/internal/pkg/config/tls.go b/internal/pkg/config/tls.go index d9e5446..20771fa 100644 --- a/internal/pkg/config/tls.go +++ b/internal/pkg/config/tls.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/connection/context.go b/internal/pkg/connection/context.go index da1a42b..5b9f476 100644 --- a/internal/pkg/connection/context.go +++ b/internal/pkg/connection/context.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ const ( VersionHeader = "version" ) -// ContextHelper structure to faciliate the generation of secure contexts. +// ContextHelper structure to facilitate the generation of secure contexts. type ContextHelper struct { // Version of the application sending the request. Version string @@ -50,7 +50,7 @@ func NewContextHelper(cfg *config.Config) *ContextHelper { } } -// GetContext returns a valid gRPC context with the appropiate authorization header. +// GetContext returns a valid gRPC context with the appropriate authorization header. func (ch *ContextHelper) GetContext(JWT string) (context.Context, context.CancelFunc) { md := metadata.New(map[string]string{AuthorizationHeader: JWT, AgentHeader: AgentValue, VersionHeader: ch.Version}) ctx := metadata.NewOutgoingContext(context.Background(), md) diff --git a/internal/pkg/connection/grpc.go b/internal/pkg/connection/grpc.go index 8482f4a..f49a0de 100644 --- a/internal/pkg/connection/grpc.go +++ b/internal/pkg/connection/grpc.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package connection import ( @@ -22,11 +23,10 @@ import ( "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/napptive/nerrors/pkg/nerrors" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" - "github.com/rs/zerolog/log" "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" ) // GetConnectionToPlayground creates a new connection with the playground. diff --git a/internal/pkg/entities/entities.go b/internal/pkg/entities/entities.go index 025e339..2608681 100644 --- a/internal/pkg/entities/entities.go +++ b/internal/pkg/entities/entities.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package entities import ( "fmt" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" + "github.com/napptive/grpc-catalog-go" ) // AppSummary with the application summary (all the application tags and logos) diff --git a/internal/pkg/entities/user.go b/internal/pkg/entities/user.go index 490ae27..d38659d 100644 --- a/internal/pkg/entities/user.go +++ b/internal/pkg/entities/user.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package entities type User struct { diff --git a/internal/pkg/printer/common.go b/internal/pkg/printer/common.go index 9255227..2d662a3 100644 --- a/internal/pkg/printer/common.go +++ b/internal/pkg/printer/common.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package printer // ResultPrinter defines the operations that a printer must define. Multiple printer are diff --git a/internal/pkg/printer/table.go b/internal/pkg/printer/table.go index 47e7c02..be9f80a 100644 --- a/internal/pkg/printer/table.go +++ b/internal/pkg/printer/table.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,11 @@ package printer import ( "fmt" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" "os" "text/tabwriter" "text/template" + "github.com/napptive/grpc-catalog-go" "github.com/napptive/nerrors/pkg/nerrors" ) diff --git a/internal/pkg/printer/tabletemplate.go b/internal/pkg/printer/tabletemplate.go index 3ea346e..7e44877 100644 --- a/internal/pkg/printer/tabletemplate.go +++ b/internal/pkg/printer/tabletemplate.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,10 @@ package printer import ( - grpc_catalog_common_go "github.com/napptive/grpc-catalog-common-go" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" "reflect" + "github.com/napptive/grpc-catalog-common-go" + "github.com/napptive/grpc-catalog-go" "github.com/napptive/nerrors/pkg/nerrors" ) diff --git a/internal/pkg/provider/metadata/elastic_it_test.go b/internal/pkg/provider/metadata/elastic_it_test.go index d40ffec..aaf5c50 100644 --- a/internal/pkg/provider/metadata/elastic_it_test.go +++ b/internal/pkg/provider/metadata/elastic_it_test.go @@ -5,8 +5,9 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" "github.com/rs/zerolog/log" - "strings" "syreclabs.com/go/faker" + + "strings" ) var _ = ginkgo.Describe("Elastic Provider test", func() { diff --git a/internal/pkg/provider/metadata/elastic_provider.go b/internal/pkg/provider/metadata/elastic_provider.go index b6008dd..ae517a7 100644 --- a/internal/pkg/provider/metadata/elastic_provider.go +++ b/internal/pkg/provider/metadata/elastic_provider.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,13 +27,10 @@ import ( "time" "github.com/elastic/go-elasticsearch/v7" - "github.com/elastic/go-elasticsearch/v7/esapi" - "github.com/napptive/catalog-manager/internal/pkg/entities" "github.com/napptive/catalog-manager/internal/pkg/utils" "github.com/napptive/nerrors/pkg/nerrors" - "github.com/rs/zerolog/log" ) diff --git a/internal/pkg/provider/metadata/provider.go b/internal/pkg/provider/metadata/provider.go index e6775d2..be73e9a 100644 --- a/internal/pkg/provider/metadata/provider.go +++ b/internal/pkg/provider/metadata/provider.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/provider/metadata/provider_suite_test.go b/internal/pkg/provider/metadata/provider_suite_test.go index b725ddb..168e73b 100644 --- a/internal/pkg/provider/metadata/provider_suite_test.go +++ b/internal/pkg/provider/metadata/provider_suite_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package metadata import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" + "testing" ) diff --git a/internal/pkg/provider/metadata/provider_test.go b/internal/pkg/provider/metadata/provider_test.go index f499b33..6d2391d 100644 --- a/internal/pkg/provider/metadata/provider_test.go +++ b/internal/pkg/provider/metadata/provider_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/provider/user-provider/provider.go b/internal/pkg/provider/user-provider/provider.go index 7804280..a1ff4fe 100644 --- a/internal/pkg/provider/user-provider/provider.go +++ b/internal/pkg/provider/user-provider/provider.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package user_provider import "github.com/napptive/catalog-manager/internal/pkg/entities" diff --git a/internal/pkg/provider/user-provider/user_provider.go b/internal/pkg/provider/user-provider/user_provider.go index 04c559a..6eb10ce 100644 --- a/internal/pkg/provider/user-provider/user_provider.go +++ b/internal/pkg/provider/user-provider/user_provider.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package user_provider import ( diff --git a/internal/pkg/provider/user-provider/user_provider_it_test.go b/internal/pkg/provider/user-provider/user_provider_it_test.go index e04b225..8425c45 100644 --- a/internal/pkg/provider/user-provider/user_provider_it_test.go +++ b/internal/pkg/provider/user-provider/user_provider_it_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,15 +26,18 @@ docker exec -it local-postgres psql -h localhost -U postgres -d postgres -p 5432 3.- create the schema and table CREATE SCHEMA IF NOT EXISTS catalog; CREATE TABLE IF NOT EXISTS catalog.users ( - username VARCHAR(50) PRIMARY KEY NOT NULL, - salt VARCHAR(16) NOT NULL, - salted_password VARCHAR(256) -); + username VARCHAR(50) PRIMARY KEY NOT NULL, + salt VARCHAR(16) NOT NULL, + salted_password VARCHAR(256) + +); */ + package user_provider import ( + "context" "time" "github.com/napptive/catalog-manager/internal/pkg/utils" @@ -42,8 +45,6 @@ import ( "github.com/onsi/ginkgo" "github.com/onsi/gomega" "github.com/rs/zerolog/log" - - "context" ) var _ = ginkgo.Describe("Provider test", func() { diff --git a/internal/pkg/provider/user-provider/user_provider_suite_test.go b/internal/pkg/provider/user-provider/user_provider_suite_test.go index b5cdd7b..1312415 100644 --- a/internal/pkg/provider/user-provider/user_provider_suite_test.go +++ b/internal/pkg/provider/user-provider/user_provider_suite_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/provider/user-provider/user_provider_test.go b/internal/pkg/provider/user-provider/user_provider_test.go index 16d2b03..610387c 100644 --- a/internal/pkg/provider/user-provider/user_provider_test.go +++ b/internal/pkg/provider/user-provider/user_provider_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/server/admin/admin_suite_test.go b/internal/pkg/server/admin/admin_suite_test.go index 9612994..9c8f5f2 100644 --- a/internal/pkg/server/admin/admin_suite_test.go +++ b/internal/pkg/server/admin/admin_suite_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/server/admin/handler.go b/internal/pkg/server/admin/handler.go index 263fbfb..c48657a 100644 --- a/internal/pkg/server/admin/handler.go +++ b/internal/pkg/server/admin/handler.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,9 @@ package admin import ( "context" "fmt" - grpc_catalog_common_go "github.com/napptive/grpc-catalog-common-go" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" + + "github.com/napptive/grpc-catalog-common-go" + "github.com/napptive/grpc-catalog-go" "github.com/napptive/nerrors/pkg/nerrors" "github.com/rs/zerolog/log" ) diff --git a/internal/pkg/server/admin/manager.go b/internal/pkg/server/admin/manager.go index b412d21..7df42b6 100644 --- a/internal/pkg/server/admin/manager.go +++ b/internal/pkg/server/admin/manager.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/server/admin/manager_test.go b/internal/pkg/server/admin/manager_test.go index 5a42fe5..0b5a321 100644 --- a/internal/pkg/server/admin/manager_test.go +++ b/internal/pkg/server/admin/manager_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/server/admin/mocks.go b/internal/pkg/server/admin/mocks.go index fbe1d67..5737e59 100644 --- a/internal/pkg/server/admin/mocks.go +++ b/internal/pkg/server/admin/mocks.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,5 +19,5 @@ package admin //go:generate mockgen -destination metadata_provider_mock.go -package=admin github.com/napptive/catalog-manager/internal/pkg/provider/metadata MetadataProvider //go:generate mockgen -destination storage_mock.go -package=admin github.com/napptive/catalog-manager/internal/pkg/storage StorageManager -//Mock is a place holder to unify all mock generators. +// Mock is a place holder to unify all mock generators. func Mock() {} diff --git a/internal/pkg/server/apps/catalog_manager_mock.go b/internal/pkg/server/apps/catalog_manager_mock.go index 023f71c..78ba1f1 100644 --- a/internal/pkg/server/apps/catalog_manager_mock.go +++ b/internal/pkg/server/apps/catalog_manager_mock.go @@ -50,7 +50,7 @@ func (mr *MockCatalogManagerMockRecorder) Add(arg0, arg1, arg2, arg3 interface{} } // Download mocks base method. -func (m *MockCatalogManager) Download(arg0 string, arg1 bool, arg2 string) ([]*entities.FileInfo, error) { +func (m *MockCatalogManager) Download(arg0 string, arg1, arg2 bool) ([]*entities.FileInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Download", arg0, arg1, arg2) ret0, _ := ret[0].([]*entities.FileInfo) @@ -65,7 +65,7 @@ func (mr *MockCatalogManagerMockRecorder) Download(arg0, arg1, arg2 interface{}) } // Get mocks base method. -func (m *MockCatalogManager) Get(arg0, arg1 string) (*entities.ExtendedApplicationMetadata, error) { +func (m *MockCatalogManager) Get(arg0 string, arg1 bool) (*entities.ExtendedApplicationMetadata, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", arg0, arg1) ret0, _ := ret[0].(*entities.ExtendedApplicationMetadata) @@ -80,7 +80,7 @@ func (mr *MockCatalogManagerMockRecorder) Get(arg0, arg1 interface{}) *gomock.Ca } // List mocks base method. -func (m *MockCatalogManager) List(arg0, arg1 string) ([]*entities.AppSummary, error) { +func (m *MockCatalogManager) List(arg0 map[string]*bool, arg1 bool) ([]*entities.AppSummary, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "List", arg0, arg1) ret0, _ := ret[0].([]*entities.AppSummary) diff --git a/internal/pkg/server/apps/handler.go b/internal/pkg/server/apps/handler.go index 749358f..25c45a3 100644 --- a/internal/pkg/server/apps/handler.go +++ b/internal/pkg/server/apps/handler.go @@ -20,8 +20,9 @@ import ( "context" "github.com/napptive/catalog-manager/internal/pkg/config" - grpc_catalog_common_go "github.com/napptive/grpc-catalog-common-go" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" + "github.com/napptive/catalog-manager/internal/pkg/server/resolver" + "github.com/napptive/grpc-catalog-common-go" + "github.com/napptive/grpc-catalog-go" "github.com/napptive/nerrors/pkg/nerrors" "github.com/rs/zerolog/log" "google.golang.org/grpc/metadata" @@ -29,15 +30,17 @@ import ( // Handler for apps operations. type Handler struct { - manager Manager - cfg *config.JWTConfig + manager Manager + cfg *config.JWTConfig + resolver resolver.PermissionResolver } // NewHandler creates a new instance of the handler. -func NewHandler(cfg *config.JWTConfig, manager Manager) *Handler { +func NewHandler(cfg *config.JWTConfig, manager Manager, resolver resolver.PermissionResolver) *Handler { return &Handler{ - manager: manager, - cfg: cfg, + manager: manager, + cfg: cfg, + resolver: resolver, } } @@ -64,11 +67,19 @@ func (h *Handler) Deploy(ctx context.Context, request *grpc_catalog_go.DeployApp if err := request.Validate(); err != nil { return nil, nerrors.FromError(err).ToGRPC() } + + // check user permission in the application namespace (for private apps) + accountAllowed, err := h.resolver.CheckAccountPermissions(ctx, request.ApplicationId, false) + if err != nil { + log.Error().Err(err).Str("application_name", request.ApplicationId).Msg("error checking permission, unable to download the application to deploy it") + return nil, nerrors.FromError(err).ToGRPC() + } + jwt, err := h.extractIncomingJWT(ctx) if err != nil { return nil, nerrors.FromError(err).ToGRPC() } - response, err := h.manager.Deploy(jwt, request.ApplicationId, request.TargetEnvironmentQualifiedName, request.TargetPlaygroundApiUrl, request.InstanceConfiguration) + response, err := h.manager.Deploy(jwt, request.ApplicationId, request.TargetEnvironmentQualifiedName, request.TargetPlaygroundApiUrl, request.InstanceConfiguration, *accountAllowed) if err != nil { return nil, nerrors.FromError(err).ToGRPC() } @@ -81,7 +92,14 @@ func (h *Handler) GetConfiguration(ctx context.Context, request *grpc_catalog_go return nil, nerrors.FromError(err).ToGRPC() } - conf, err := h.manager.GetConfiguration(request.ApplicationId) + // check user permission in the application namespace (for private apps) + accountAllowed, err := h.resolver.CheckAccountPermissions(ctx, request.ApplicationId, false) + if err != nil { + log.Error().Err(err).Str("application_name", request.ApplicationId).Msg("error checking permission, unable to get application configuration") + return nil, nerrors.FromError(err).ToGRPC() + } + + conf, err := h.manager.GetConfiguration(request.ApplicationId, *accountAllowed) if err != nil { log.Error().Err(err).Str("applicationID", request.ApplicationId).Msg("error getting application configuration") return nil, nerrors.FromError(err).ToGRPC() diff --git a/internal/pkg/server/apps/handler_test.go b/internal/pkg/server/apps/handler_test.go index f558fc4..7a9afe1 100644 --- a/internal/pkg/server/apps/handler_test.go +++ b/internal/pkg/server/apps/handler_test.go @@ -17,14 +17,14 @@ package apps import ( - "context" "fmt" + "github.com/napptive/catalog-manager/internal/pkg/server/resolver" "github.com/golang/mock/gomock" "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/napptive/catalog-manager/internal/pkg/utils" - grpc_catalog_common_go "github.com/napptive/grpc-catalog-common-go" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" + "github.com/napptive/grpc-catalog-common-go" + "github.com/napptive/grpc-catalog-go" "github.com/onsi/ginkgo" "github.com/onsi/gomega" ) @@ -49,7 +49,8 @@ var _ = ginkgo.Describe("Apps handler test with auth enabled by JWT", func() { ctrl = gomock.NewController(ginkgo.GinkgoT()) manager = NewMockManager(ctrl) - handler = NewHandler(&handlerConfig.JWTConfig, manager) + permissionResolver := resolver.NewPermissionResolver(true, config.NewTeamConfig(false, "", "")) + handler = NewHandler(&handlerConfig.JWTConfig, manager, *permissionResolver) }) ginkgo.AfterEach(func() { @@ -71,7 +72,7 @@ var _ = ginkgo.Describe("Apps handler test with auth enabled by JWT", func() { ginkgo.Context("with a JWT", func() { ginkgo.It("should be able to deploy apps", func() { ctx := utils.CreateTestJWTAuthIncomingContext("user", "account", true, "authorization", "jwt") - manager.EXPECT().Deploy(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&grpc_catalog_common_go.OpResponse{}, nil) + manager.EXPECT().Deploy(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&grpc_catalog_common_go.OpResponse{}, nil) response, err := handler.Deploy(ctx, &grpc_catalog_go.DeployApplicationRequest{ ApplicationId: testAppName, TargetEnvironmentQualifiedName: testTargetEnvironment, @@ -85,14 +86,15 @@ var _ = ginkgo.Describe("Apps handler test with auth enabled by JWT", func() { ginkgo.Context("getting application configuration", func() { ginkgo.It("Should be able to return application configuration", func() { appID := fmt.Sprintf("%s/%s", "username", "application") + ctx := utils.CreateTestJWTAuthIncomingContext("user", "account", true, "authorization", "jwt") - manager.EXPECT().GetConfiguration(appID).Return(&grpc_catalog_go.GetConfigurationResponse{ + manager.EXPECT().GetConfiguration(appID, gomock.Any()).Return(&grpc_catalog_go.GetConfigurationResponse{ IsApplication: true, ApplicationDefaultName: "name", SpecComponentsRaw: "", }, nil) - conf, err := handler.GetConfiguration(context.Background(), &grpc_catalog_go.GetConfigurationRequest{ + conf, err := handler.GetConfiguration(ctx, &grpc_catalog_go.GetConfigurationRequest{ ApplicationId: appID, }) gomega.Expect(err).To(gomega.Succeed()) @@ -100,14 +102,15 @@ var _ = ginkgo.Describe("Apps handler test with auth enabled by JWT", func() { }) ginkgo.It("Should be able to return application configuration when the catalog application is not an oam application", func() { appID := fmt.Sprintf("%s/%s", "username", "application") + ctx := utils.CreateTestJWTAuthIncomingContext("user", "account", true, "authorization", "jwt") - manager.EXPECT().GetConfiguration(appID).Return(&grpc_catalog_go.GetConfigurationResponse{ + manager.EXPECT().GetConfiguration(appID, gomock.Any()).Return(&grpc_catalog_go.GetConfigurationResponse{ IsApplication: false, ApplicationDefaultName: "", SpecComponentsRaw: "", }, nil) - conf, err := handler.GetConfiguration(context.Background(), &grpc_catalog_go.GetConfigurationRequest{ + conf, err := handler.GetConfiguration(ctx, &grpc_catalog_go.GetConfigurationRequest{ ApplicationId: appID, }) gomega.Expect(err).To(gomega.Succeed()) diff --git a/internal/pkg/server/apps/manager.go b/internal/pkg/server/apps/manager.go index 76c3d90..7e08803 100644 --- a/internal/pkg/server/apps/manager.go +++ b/internal/pkg/server/apps/manager.go @@ -19,12 +19,12 @@ package apps import ( "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/napptive/catalog-manager/internal/pkg/connection" - catalog_manager "github.com/napptive/catalog-manager/internal/pkg/server/catalog-manager" - grpc_catalog_common_go "github.com/napptive/grpc-catalog-common-go" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" - grpc_playground_apps_go "github.com/napptive/grpc-playground-apps-go" + "github.com/napptive/catalog-manager/internal/pkg/server/catalog-manager" + "github.com/napptive/grpc-catalog-common-go" + "github.com/napptive/grpc-catalog-go" + "github.com/napptive/grpc-playground-apps-go" "github.com/napptive/nerrors/pkg/nerrors" - oamutils "github.com/napptive/oam-utils/pkg/oam-utils" + "github.com/napptive/oam-utils/pkg/oam-utils" "github.com/rs/zerolog/log" ) @@ -32,9 +32,10 @@ type Manager interface { // Deploy an application on a target Playground platform. This endpoint // will gather the application information and send it to the target // playground platform. - Deploy(userToken string, applicationID string, targetEnvironmentQualifiedName string, targetPlaygroundApiURL string, instanceConfiguration map[string]*grpc_catalog_go.ApplicationInstanceConfiguration) (*grpc_catalog_common_go.OpResponse, error) + Deploy(userToken string, applicationID string, targetEnvironmentQualifiedName string, targetPlaygroundApiURL string, + instanceConfiguration map[string]*grpc_catalog_go.ApplicationInstanceConfiguration, allowed bool) (*grpc_catalog_common_go.OpResponse, error) // GetConfiguration returns the application configuration (name for now) - GetConfiguration(applicationID string) (*grpc_catalog_go.GetConfigurationResponse, error) + GetConfiguration(applicationID string, allowed bool) (*grpc_catalog_go.GetConfigurationResponse, error) } // Manager for apps operations. @@ -58,14 +59,12 @@ func NewManager(cfg *config.Config, catalogManager catalog_manager.Manager) Mana // will gather the application information and send it to the target // playground platform. func (m *manager) Deploy(userToken string, applicationID string, targetEnvironmentQualifiedName string, targetPlaygroundApiURL string, - instanceConfiguration map[string]*grpc_catalog_go.ApplicationInstanceConfiguration) (*grpc_catalog_common_go.OpResponse, error) { + instanceConfiguration map[string]*grpc_catalog_go.ApplicationInstanceConfiguration, allowed bool) (*grpc_catalog_common_go.OpResponse, error) { - log.Debug().Str("application_id", applicationID).Str("eqn", targetEnvironmentQualifiedName).Str("target_playground_api_url", targetPlaygroundApiURL).Msg("deploying application") - log.Debug().Interface("instanceConfig", instanceConfiguration).Msg("instance configuration") - - // Retrieve the target application - app, err := m.catalogManager.Download(applicationID, true, "") + // Download the application + app, err := m.catalogManager.Download(applicationID, true, allowed) if err != nil { + log.Error().Err(err).Str("application_id", applicationID).Msg("error downloading the application, unable to deploy it") return nil, err } @@ -92,6 +91,7 @@ func (m *manager) Deploy(userToken string, applicationID string, targetEnvironme if err != nil { return nil, nerrors.FromGRPC(err) } + return &grpc_catalog_common_go.OpResponse{ Status: grpc_catalog_common_go.OpStatus_SUCCESS, StatusName: grpc_catalog_common_go.OpStatus_SUCCESS.String(), @@ -100,7 +100,7 @@ func (m *manager) Deploy(userToken string, applicationID string, targetEnvironme } func (m *manager) toInstanceConfiguration(instanceConfiguration map[string]*grpc_catalog_go.ApplicationInstanceConfiguration) map[string]*grpc_playground_apps_go.ApplicationInstanceConfiguration { - newConf := make(map[string]*grpc_playground_apps_go.ApplicationInstanceConfiguration, 0) + newConf := make(map[string]*grpc_playground_apps_go.ApplicationInstanceConfiguration) for appName, conf := range instanceConfiguration { newConf[appName] = &grpc_playground_apps_go.ApplicationInstanceConfiguration{ ApplicationName: conf.ApplicationDefaultName, @@ -110,25 +110,25 @@ func (m *manager) toInstanceConfiguration(instanceConfiguration map[string]*grpc return newConf } -// GetConfiguration returns the application configuration (name for now) -// TODO: add spec -func (m *manager) GetConfiguration(applicationID string) (*grpc_catalog_go.GetConfigurationResponse, error) { +// GetConfiguration returns the application configuration +func (m *manager) GetConfiguration(applicationID string, allowed bool) (*grpc_catalog_go.GetConfigurationResponse, error) { - // Get application files (Checking if application exists) - files, err := m.catalogManager.Download(applicationID, false, "") + log.Debug().Str("application_id", applicationID).Bool("allowed", allowed).Msg("getting configuration") + // Download the application + files, err := m.catalogManager.Download(applicationID, false, allowed) if err != nil { - log.Error().Err(err).Str("applicationID", applicationID).Msg("error getting application files") + log.Error().Err(err).Str("application_id", applicationID).Msg("error downloading the application, unable to get application configuration") return nil, err } - appFiles := make([]*oamutils.ApplicationFile, 0) + appFiles := make([]*oam_utils.ApplicationFile, 0) // Get Application configuration for _, file := range files { - appFiles = append(appFiles, &oamutils.ApplicationFile{FileName: file.Path, Content: file.Data}) + appFiles = append(appFiles, &oam_utils.ApplicationFile{FileName: file.Path, Content: file.Data}) } - app, err := oamutils.NewApplication(appFiles) + app, err := oam_utils.NewApplication(appFiles) if err != nil { // check the error, perhaps the catalog application no correspond to an oam application log.Error().Err(err).Str("applicationID", applicationID).Msg("error getting application files") diff --git a/internal/pkg/server/apps/manager_mock.go b/internal/pkg/server/apps/manager_mock.go index 9e39496..a95adec 100644 --- a/internal/pkg/server/apps/manager_mock.go +++ b/internal/pkg/server/apps/manager_mock.go @@ -36,31 +36,31 @@ func (m *MockManager) EXPECT() *MockManagerMockRecorder { } // Deploy mocks base method. -func (m *MockManager) Deploy(arg0, arg1, arg2, arg3 string, arg4 map[string]*grpc_catalog_go.ApplicationInstanceConfiguration) (*grpc_catalog_common_go.OpResponse, error) { +func (m *MockManager) Deploy(arg0, arg1, arg2, arg3 string, arg4 map[string]*grpc_catalog_go.ApplicationInstanceConfiguration, arg5 bool) (*grpc_catalog_common_go.OpResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Deploy", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "Deploy", arg0, arg1, arg2, arg3, arg4, arg5) ret0, _ := ret[0].(*grpc_catalog_common_go.OpResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // Deploy indicates an expected call of Deploy. -func (mr *MockManagerMockRecorder) Deploy(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockManagerMockRecorder) Deploy(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deploy", reflect.TypeOf((*MockManager)(nil).Deploy), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deploy", reflect.TypeOf((*MockManager)(nil).Deploy), arg0, arg1, arg2, arg3, arg4, arg5) } // GetConfiguration mocks base method. -func (m *MockManager) GetConfiguration(arg0 string) (*grpc_catalog_go.GetConfigurationResponse, error) { +func (m *MockManager) GetConfiguration(arg0 string, arg1 bool) (*grpc_catalog_go.GetConfigurationResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetConfiguration", arg0) + ret := m.ctrl.Call(m, "GetConfiguration", arg0, arg1) ret0, _ := ret[0].(*grpc_catalog_go.GetConfigurationResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // GetConfiguration indicates an expected call of GetConfiguration. -func (mr *MockManagerMockRecorder) GetConfiguration(arg0 interface{}) *gomock.Call { +func (mr *MockManagerMockRecorder) GetConfiguration(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetConfiguration", reflect.TypeOf((*MockManager)(nil).GetConfiguration), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetConfiguration", reflect.TypeOf((*MockManager)(nil).GetConfiguration), arg0, arg1) } diff --git a/internal/pkg/server/apps/manager_test.go b/internal/pkg/server/apps/manager_test.go index 8e76c2b..d65ccbc 100644 --- a/internal/pkg/server/apps/manager_test.go +++ b/internal/pkg/server/apps/manager_test.go @@ -13,12 +13,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package apps import ( "fmt" - gomock "github.com/golang/mock/gomock" + "github.com/golang/mock/gomock" "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/napptive/catalog-manager/internal/pkg/entities" "github.com/napptive/nerrors/pkg/nerrors" @@ -81,42 +82,40 @@ var _ = ginkgo.Describe("Apps manager test", func() { appID := fmt.Sprintf("%s/%s", "username", "application") - catalogManager.EXPECT().Download(appID, false, "").Return([]*entities.FileInfo{{ + catalogManager.EXPECT().Download(appID, false, true).Return([]*entities.FileInfo{{ Path: "application.yaml", Data: []byte(application), }}, nil) - config, err := manager.GetConfiguration(appID) + config, err := manager.GetConfiguration(appID, true) gomega.Expect(err).Should(gomega.Succeed()) gomega.Expect(config).ShouldNot(gomega.BeNil()) gomega.Expect(config.IsApplication).Should(gomega.BeTrue()) }) - ginkgo.It("Should be able to get application configuration, when the files do not containt any applications", func() { + ginkgo.It("Should be able to get application configuration, when the files do not contain any applications", func() { appID := fmt.Sprintf("%s/%s", "username", "application") - catalogManager.EXPECT().Download(appID, false, "").Return([]*entities.FileInfo{{ + catalogManager.EXPECT().Download(appID, false, true).Return([]*entities.FileInfo{{ Path: "cm.yaml", Data: []byte(cm), }}, nil) - config, err := manager.GetConfiguration(appID) + config, err := manager.GetConfiguration(appID, true) gomega.Expect(err).Should(gomega.Succeed()) gomega.Expect(config).ShouldNot(gomega.BeNil()) gomega.Expect(config.IsApplication).ShouldNot(gomega.BeTrue()) }) - ginkgo.It("Should not be able to get application configuration if the application does not exists", func() { appID := fmt.Sprintf("%s/%s", "username", "application") - catalogManager.EXPECT().Download(appID, false, "").Return([]*entities.FileInfo{}, nerrors.NewNotFoundError("Application not found")) + catalogManager.EXPECT().Download(appID, false, true).Return([]*entities.FileInfo{}, nerrors.NewNotFoundError("Application not found")) - _, err := manager.GetConfiguration(appID) + _, err := manager.GetConfiguration(appID, true) gomega.Expect(err).ShouldNot(gomega.Succeed()) }) - }) }) diff --git a/internal/pkg/server/apps/mocks.go b/internal/pkg/server/apps/mocks.go index ff0df3b..65c4b4e 100644 --- a/internal/pkg/server/apps/mocks.go +++ b/internal/pkg/server/apps/mocks.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/server/catalog-manager/catalog_manager_suites_test.go b/internal/pkg/server/catalog-manager/catalog_manager_suites_test.go index 95d584a..366fe8a 100644 --- a/internal/pkg/server/catalog-manager/catalog_manager_suites_test.go +++ b/internal/pkg/server/catalog-manager/catalog_manager_suites_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/server/catalog-manager/handler.go b/internal/pkg/server/catalog-manager/handler.go index a877c2e..9a65baa 100644 --- a/internal/pkg/server/catalog-manager/handler.go +++ b/internal/pkg/server/catalog-manager/handler.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,9 @@ import ( "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/napptive/catalog-manager/internal/pkg/entities" - "github.com/napptive/catalog-manager/internal/pkg/utils" - grpc_catalog_common_go "github.com/napptive/grpc-catalog-common-go" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" + "github.com/napptive/catalog-manager/internal/pkg/server/resolver" + "github.com/napptive/grpc-catalog-common-go" + "github.com/napptive/grpc-catalog-go" "github.com/napptive/nerrors/pkg/nerrors" "github.com/napptive/njwt/pkg/interceptors" "github.com/rs/zerolog/log" @@ -39,12 +39,13 @@ type Handler struct { manager Manager // authEnabled is a boolean to check the user authEnabled bool + resolver resolver.PermissionResolver } // TODO: Check update/get concurrency -func NewHandler(manager Manager, authEnabled bool, teamConfig config.TeamConfig) *Handler { - return &Handler{manager: manager, authEnabled: authEnabled, teamConfig: teamConfig} +func NewHandler(manager Manager, authEnabled bool, teamConfig config.TeamConfig, resolver resolver.PermissionResolver) *Handler { + return &Handler{manager: manager, authEnabled: authEnabled, teamConfig: teamConfig, resolver: resolver} } // Add a new application in the catalog @@ -182,51 +183,52 @@ func (h *Handler) Upload(ctx context.Context, request *grpc_catalog_go.UploadApp // Download an application from catalog func (h *Handler) Download(request *grpc_catalog_go.DownloadApplicationRequest, server grpc_catalog_go.Catalog_DownloadServer) error { + // validate if err := request.Validate(); err != nil { return nerrors.FromError(err).ToGRPC() } - accountName := "" - // if authentication is enabled -> Get the account name to filter all private apps by namespace - if h.authEnabled { - accountNameFromCtx, err := h.getAccountNameFromContext(server.Context()) - if err != nil { - log.Error().Err(err).Msg("error getting username from context") - return err - } - accountName = *accountNameFromCtx + // check user permission in the application namespace (for private apps) + accountAllowed, err := h.resolver.CheckAccountPermissions(server.Context(), request.ApplicationId, false) + if err != nil { + log.Error().Err(err).Str("application_name", request.ApplicationId).Msg("error checking permission, unable to download the application") + return nerrors.FromError(err).ToGRPC() } - - files, err := h.manager.Download(request.ApplicationId, request.Compressed, accountName) + // download the application + files, err := h.manager.Download(request.ApplicationId, request.Compressed, *accountAllowed) if err != nil { + log.Error().Err(err).Str("application_name", request.ApplicationId).Msg("error downloading the application") return nerrors.FromError(err).ToGRPC() } - + // send the files for _, file := range files { if err := server.Send(file.ToGRPC()); err != nil { return nerrors.NewInternalErrorFrom(err, "unable to send the file").ToGRPC() } } - return nil } // Remove an application from the catalog func (h *Handler) Remove(ctx context.Context, request *grpc_catalog_go.RemoveApplicationRequest) (*grpc_catalog_common_go.OpResponse, error) { + // validate if err := request.Validate(); err != nil { return nil, nerrors.FromError(err).ToGRPC() } // check the user (check if after validation yto be sure the ApplicationId is filled if err := h.validateUser(ctx, request.ApplicationId, "remove", true); err != nil { - return nil, err + log.Error().Err(err).Str("application_name", request.ApplicationId).Msg("error validating user, unable to remove the application") + return nil, nerrors.FromError(err).ToGRPC() } + // remove the application if err := h.manager.Remove(request.ApplicationId); err != nil { return nil, nerrors.FromError(err).ToGRPC() } + // return response return &grpc_catalog_common_go.OpResponse{ Status: grpc_catalog_common_go.OpStatus_SUCCESS, StatusName: grpc_catalog_common_go.OpStatus_SUCCESS.String(), @@ -234,27 +236,45 @@ func (h *Handler) Remove(ctx context.Context, request *grpc_catalog_go.RemoveApp }, nil } -// List returns a list with all the applications +// List returns a list with all the required applications func (h *Handler) List(ctx context.Context, request *grpc_catalog_go.ListApplicationsRequest) (*grpc_catalog_go.ApplicationList, error) { + namespacesMap := make(map[string]*bool) - accountName := "" - // if authentication is enabled -> Get the account name to filter all private apps by namespace - if h.authEnabled { - accountNameFromCtx, err := h.getAccountNameFromContext(ctx) + // Boolean to indicate if list all the public applications + var showPublicApps bool + + if request.Namespace != "" { + showPublicApps = false + // check user permission in the application namespace (for private apps) + accountAllowed, err := h.resolver.CheckAccountPermissions(ctx, fmt.Sprintf("%s/dummy", request.Namespace), false) + if err != nil { + log.Error().Err(err).Str("namespace", request.Namespace).Msg("error checking permission, unable to list applications") + return nil, nerrors.FromError(err).ToGRPC() + } + if *accountAllowed { + accountAllowed = nil + } + namespacesMap[request.Namespace] = accountAllowed + } else { + ownApps := true + showPublicApps = true + + // getClaim + claim, err := interceptors.GetClaimFromContext(ctx) if err != nil { - log.Error().Err(err).Msg("error getting username from context") return nil, err } - accountName = *accountNameFromCtx + for _, account := range claim.Accounts { + namespacesMap[account.Name] = &ownApps + } } - returned, err := h.manager.List(request.Namespace, accountName) + list, err := h.manager.List(namespacesMap, showPublicApps) if err != nil { return nil, nerrors.FromError(err).ToGRPC() } - summaryList := make([]*grpc_catalog_go.ApplicationSummary, 0) - for _, app := range returned { + for _, app := range list { summaryList = append(summaryList, app.ToApplicationSummary()) } @@ -264,25 +284,26 @@ func (h *Handler) List(ctx context.Context, request *grpc_catalog_go.ListApplica // Info returns the detail of a given application func (h *Handler) Info(ctx context.Context, request *grpc_catalog_go.InfoApplicationRequest) (*grpc_catalog_go.InfoApplicationResponse, error) { + + // validate if err := request.Validate(); err != nil { return nil, nerrors.FromError(err).ToGRPC() } - accountName := "" - // if authentication is enabled -> Get the account name to filter all private apps by namespace - if h.authEnabled { - accountNameFromCtx, err := h.getAccountNameFromContext(ctx) - if err != nil { - log.Error().Err(err).Msg("error getting username from context") - return nil, err - } - accountName = *accountNameFromCtx + // check user permission in the application namespace (for private apps) + accountAllowed, err := h.resolver.CheckAccountPermissions(ctx, request.ApplicationId, false) + if err != nil { + log.Error().Err(err).Str("application_name", request.ApplicationId).Msg("error checking permission, get application info") + return nil, nerrors.FromError(err).ToGRPC() } - retrieved, err := h.manager.Get(request.ApplicationId, accountName) + // get the application info + retrieved, err := h.manager.Get(request.ApplicationId, *accountAllowed) if err != nil { return nil, nerrors.FromError(err).ToGRPC() } + + // return the response return &grpc_catalog_go.InfoApplicationResponse{ Namespace: retrieved.Namespace, ApplicationName: retrieved.ApplicationName, @@ -295,7 +316,7 @@ func (h *Handler) Info(ctx context.Context, request *grpc_catalog_go.InfoApplica } // Summary returns the summary of the catalog (#repositories, #applications and #tags) -func (h *Handler) Summary(ctx context.Context, request *grpc_catalog_common_go.EmptyRequest) (*grpc_catalog_go.SummaryResponse, error) { +func (h *Handler) Summary(_ context.Context, _ *grpc_catalog_common_go.EmptyRequest) (*grpc_catalog_go.SummaryResponse, error) { summary, err := h.manager.Summary() if err != nil { @@ -312,19 +333,13 @@ func (h *Handler) Update(ctx context.Context, request *grpc_catalog_go.UpdateReq sErr := nerrors.NewFailedPreconditionError("enable authentication to make use of private apps") return nil, nerrors.FromError(sErr).ToGRPC() } - - accountName, err := h.getAccountNameFromContext(ctx) - if err != nil { - log.Error().Err(err).Str("namespace", request.Namespace). - Str("application", request.ApplicationName).Msg("error getting username, unable to change application visibility") - return nil, nerrors.NewInternalErrorFrom(err, "unable to change") - } - if *accountName != request.Namespace { - log.Error().Str("namespace", request.Namespace). - Str("application", request.ApplicationName).Str("accountName", *accountName).Msg("unable to change application visibility") - sErr := nerrors.NewFailedPreconditionError("A user can only change the visibility of their apps") - return nil, nerrors.FromError(sErr).ToGRPC() + // check the user (check if after validation yto be sure the ApplicationId is filled + appName := fmt.Sprintf("%s/%s", request.Namespace, request.ApplicationName) + if err := h.validateUser(ctx, appName, "change visibility", true); err != nil { + log.Error().Err(err).Str("application_name", appName).Msg("error validating user, unable to change the application visibility") + return nil, nerrors.FromError(err).ToGRPC() } + if err := h.manager.UpdateApplicationVisibility(request.Namespace, request.ApplicationName, request.Private); err != nil { log.Error().Err(err).Str("namespace", request.Namespace). Str("application", request.ApplicationName).Msg("error changing application visibility") @@ -345,77 +360,15 @@ func (h *Handler) Update(ctx context.Context, request *grpc_catalog_go.UpdateReq // validateUser check if the user in the context is the same as the repo name func (h *Handler) validateUser(ctx context.Context, appName string, action string, requireAdminPrivilege bool) error { - - // check the user (check if after validation to be sure the ApplicationName is filled - if h.authEnabled { - claim, err := interceptors.GetClaimFromContext(ctx) - if err != nil { - return err - } - log.Debug().Interface("user", claim).Msg("validating user") - - // get the repoName - _, appID, err := utils.DecomposeApplicationID(appName) - if err != nil { - return err - } - - log.Debug().Str("app namespace", appID.Namespace).Str("username", claim.Username). - Str("account_name", claim.AccountName).Bool("admin", claim.AccountAdmin).Msg("validating user") - - // A user can only remove their apps - - // Check target account - if appID.Namespace == claim.AccountName { - if requireAdminPrivilege { - if claim.AccountAdmin { - return nil - } else { - return nerrors.NewPermissionDeniedError("%s operation requires ADMIN privileges", action) - } - } - return nil - } - - // if the user is privileged and the repository is a team repository -> OK - isPrivileged := h.isPrivilegedUser(claim.Username) - isTeamRepo := h.isTeamNamespace(appID.Namespace) - log.Debug().Str("repository", appID.Namespace).Str("user", claim.Username). - Bool("isPrivileged", isPrivileged).Bool("isTeamRepo", isTeamRepo).Msg("checking privileges") - if !h.isPrivilegedUser(claim.Username) || !h.isTeamNamespace(appID.Namespace) { - return nerrors.NewPermissionDeniedError("A user can only %s their apps", action) - } - } - - return nil -} - -// isPrivilegedUser checks the user role -func (h *Handler) isPrivilegedUser(userName string) bool { - if !h.teamConfig.Enabled { - return false - } - for _, user := range h.teamConfig.PrivilegedUsers { - if user == userName { - return true - } - } - - return false -} - -// isTeamNamespace checks the namespace role -func (h *Handler) isTeamNamespace(repoName string) bool { - if !h.teamConfig.Enabled { - return false + allowed, err := h.resolver.CheckAccountPermissions(ctx, appName, requireAdminPrivilege) + if err != nil { + return err } - for _, repo := range h.teamConfig.TeamNamespaces { - if repo == repoName { - return true - } + if *allowed { + return nil } - - return false + // TODO: change the error message + return nerrors.NewPermissionDeniedError("operation not allowed") } // getAccountNameFromContext returns the username from the token @@ -424,5 +377,8 @@ func (h *Handler) getAccountNameFromContext(ctx context.Context) (*string, error if err != nil { return nil, err } - return &claim.AccountName, nil + + log.Debug().Interface("accounts", claim).Msg("borrar") + + return claim.GetCurrentAccountName() } diff --git a/internal/pkg/server/catalog-manager/handler_auth_test.go b/internal/pkg/server/catalog-manager/handler_auth_test.go index 3dac741..e333466 100644 --- a/internal/pkg/server/catalog-manager/handler_auth_test.go +++ b/internal/pkg/server/catalog-manager/handler_auth_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,14 @@ package catalog_manager import ( "context" "fmt" + "github.com/napptive/catalog-manager/internal/pkg/server/resolver" "io" "github.com/golang/mock/gomock" "github.com/napptive/catalog-manager/internal/pkg/config" "github.com/napptive/catalog-manager/internal/pkg/utils" - grpc_catalog_common_go "github.com/napptive/grpc-catalog-common-go" - grpc_catalog_go "github.com/napptive/grpc-catalog-go" + "github.com/napptive/grpc-catalog-common-go" + "github.com/napptive/grpc-catalog-go" "github.com/onsi/ginkgo" "github.com/onsi/gomega" ) @@ -82,7 +83,8 @@ var _ = ginkgo.Describe("Catalog handler test with auth enabled by JWT", func() ctrl = gomock.NewController(ginkgo.GinkgoT()) manager = NewMockManager(ctrl) addServerStream = NewMockCatalog_AddServer(ctrl) - handler = NewHandler(manager, true, teamConfig) + permissionResolver := resolver.NewPermissionResolver(true, config.NewTeamConfig(false, "", "")) + handler = NewHandler(manager, true, teamConfig, *permissionResolver) }) ginkgo.AfterEach(func() { diff --git a/internal/pkg/server/catalog-manager/manager.go b/internal/pkg/server/catalog-manager/manager.go index 161f794..5cb0c34 100644 --- a/internal/pkg/server/catalog-manager/manager.go +++ b/internal/pkg/server/catalog-manager/manager.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package catalog_manager import ( - "fmt" "regexp" "strings" @@ -46,13 +45,13 @@ type Manager interface { // Add stores a new application in the repository. Add(requestedAppID string, files []*entities.FileInfo, isPrivate bool, accountName string) (bool, error) // Download returns the files of an application - Download(requestedAppID string, compressed bool, accountName string) ([]*entities.FileInfo, error) + Download(applicationDescriptor string, compressed bool, accessNsAllowed bool) ([]*entities.FileInfo, error) // Remove removes an application from the repository Remove(requestedAppID string) error // Get returns a given application metadata - Get(requestedAppID string, accountName string) (*entities.ExtendedApplicationMetadata, error) + Get(requestedAppID string, accessNsAllowed bool) (*entities.ExtendedApplicationMetadata, error) // List returns a list of applications (without metadata and readme content) - List(namespace string, accountName string) ([]*entities.AppSummary, error) + List(accounts map[string]*bool, showPublicApps bool) ([]*entities.AppSummary, error) // Summary returns catalog summary Summary() (*entities.Summary, error) // UpdateApplicationVisibility changes the application visibility @@ -196,32 +195,29 @@ func (m *manager) Add(requestedAppID string, files []*entities.FileInfo, isPriva return isPrivate, nil } -// Download returns the files of an application -func (m *manager) Download(requestedAppID string, compressed bool, accountName string) ([]*entities.FileInfo, error) { +func (m *manager) Download(applicationID string, compressed bool, allowed bool) ([]*entities.FileInfo, error) { + + _, applicationDescriptor, err := utils.DecomposeApplicationID(applicationID) - _, appID, err := utils.DecomposeApplicationID(requestedAppID) if err != nil { - return nil, nerrors.NewFailedPreconditionErrorFrom(err, "unable to download the application") + log.Error().Err(err).Str("application_name", applicationID).Msg("error getting application name, unable to check permissions") + return nil, err } - if accountName != "" { - // If the application is private and the username is the application owner -> error - app, err := m.provider.Get(appID) - if err != nil { - log.Error().Err(err).Str("application", requestedAppID).Str("accountName", accountName).Msg("error getting application to download it") - if nerrors.FromError(err).Code == nerrors.NotFound { - return nil, nerrors.NewNotFoundError("application %s not available", appID.String()) - } - return nil, nerrors.NewInternalErrorFrom(err, "Error downloading application") - } - if app.Private { - if app.Namespace != accountName { - log.Warn().Err(err).Str("application", requestedAppID).Str("username", accountName). - Msg("error downloading application. The application is private and the user is not the owner") - return nil, nerrors.NewNotFoundError("application %s not available", appID.String()) - } + // If the application is private and the username is the application owner -> error + app, err := m.provider.Get(applicationDescriptor) + if err != nil { + if nerrors.FromError(err).Code == nerrors.NotFound { + return nil, nerrors.NewNotFoundError("application %s not available", applicationDescriptor.String()) } + return nil, nerrors.NewInternalErrorFrom(err, "Error downloading application") } - return m.stManager.GetApplication(appID.Namespace, appID.ApplicationName, appID.Tag, compressed) + if app.Private && !allowed { + log.Debug().Str("application", applicationDescriptor.String()).Msg("application private, user can access to the namespace") + return nil, nerrors.NewNotFoundError("application %s not available", applicationDescriptor.String()) + + } + + return m.stManager.GetApplication(applicationDescriptor.Namespace, applicationDescriptor.ApplicationName, applicationDescriptor.Tag, compressed) } // Remove removes an application from the repository @@ -251,7 +247,7 @@ func (m *manager) Remove(requestedAppID string) error { } // Get returns the application metadata for a given application -func (m *manager) Get(requestedAppID string, accountName string) (*entities.ExtendedApplicationMetadata, error) { +func (m *manager) Get(requestedAppID string, accessNsAllowed bool) (*entities.ExtendedApplicationMetadata, error) { _, appID, err := utils.DecomposeApplicationID(requestedAppID) if err != nil { @@ -266,8 +262,8 @@ func (m *manager) Get(requestedAppID string, accountName string) (*entities.Exte return nil, err } - if accountName != "" && app.Private && accountName != app.Namespace { - log.Warn().Str("accountName", accountName).Str("application", requestedAppID).Msg("User trying to get info of a private app") + if app.Private && !accessNsAllowed { + log.Warn().Str("application", requestedAppID).Msg("User trying to get info of a private app") return nil, nerrors.NewNotFoundError("application %s not available", appID.String()) } @@ -294,96 +290,35 @@ func (m *manager) Get(requestedAppID string, accountName string) (*entities.Exte // List returns a list of applications (without metadata and readme content) // List ([catalogURL/]namespace) -func (m *manager) List(namespace string, accountName string) ([]*entities.AppSummary, error) { - // TODO: Check if the catalogURL matches with repositoryName - // DecomposeApplicationID needs [catalogURL/]namespace/appName[:tag] - // in this case we have no appName, uses dummyAppName to simulate it - _, appID, err := utils.DecomposeApplicationID(fmt.Sprintf("%s/dummyAppName", namespace)) - if err != nil { - return nil, nerrors.NewFailedPreconditionErrorFrom(err, "unable to list applications") - } - - log.Debug().Str("required namespace", appID.Namespace).Str("accountName", accountName).Msg("application list") - - // no authentication enabled - if accountName == "" { - if namespace == "" { - private := false - apps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ - Namespace: nil, - Private: &private, - }) - if err != nil { - log.Error().Err(err).Str("required namespace", appID.Namespace).Str("accountName", accountName).Msg("error getting public apps") - return nil, err - } - return apps, nil - } else { - apps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ - Namespace: &appID.Namespace, - Private: nil, - }) - if err != nil { - log.Error().Err(err).Str("required namespace", appID.Namespace).Str("accountName", accountName).Msg("error getting public apps") - return nil, err - } - return apps, nil - } - } - - // Authentication enabled - // - namespace empty -> All public applications and his private ones - // - namespace != empty - // - namespace == username -> All the applications in namespace (public and private) - // - namespace != username -> Public applications in namespace - if appID.Namespace == "" { - // All public apps + own privates (only if authEnabled username != "") - private := true - ownApps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ - Namespace: &accountName, +// List returns a list f applications +// The private and or public applications for the accounts in accounts +// and if showPublicApps is true, already returns all the public applications +func (m *manager) List(accounts map[string]*bool, showPublicApps bool) ([]*entities.AppSummary, error) { + + result := make([]*entities.AppSummary, 0) + if showPublicApps { + private := false + apps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ + Namespace: nil, Private: &private, }) if err != nil { - log.Error().Err(err).Str("required namespace", appID.Namespace).Str("accountName", accountName).Msg("error getting public apps") return nil, err } - private = false - publicApps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ - Namespace: nil, - Private: &private, + result = append(result, apps...) + } + + for accountName, private := range accounts { + apps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ + Namespace: &accountName, + Private: private, }) if err != nil { - log.Error().Err(err).Str("required namespace", appID.Namespace).Str("accountName", accountName).Msg("error getting public apps") return nil, err } - return append(publicApps, ownApps...), nil - - } else { - if appID.Namespace == accountName { - // the required namespace is the user namespace or authentication is not enabled -> Return all the applications in the namespace (public and private) - apps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ - Namespace: &appID.Namespace, - Private: nil, - }) - if err != nil { - log.Error().Err(err).Str("required namespace", appID.Namespace).Str("accountName", accountName).Msg("error getting public apps") - return nil, err - } - return apps, nil - } else { - // return only the public application in the namespace - private := false - apps, _, err := m.provider.ListSummaryWithFilter(&metadata.ListFilter{ - Namespace: &appID.Namespace, - Private: &private, - }) - if err != nil { - log.Error().Err(err).Str("required namespace", appID.Namespace).Str("accountName", accountName).Msg("error getting public apps") - return nil, err - } - return apps, nil - } + result = append(result, apps...) } + return result, nil } // Summary returns catalog summary diff --git a/internal/pkg/server/catalog-manager/manager_mock.go b/internal/pkg/server/catalog-manager/manager_mock.go index 6dda0b5..702a8f0 100644 --- a/internal/pkg/server/catalog-manager/manager_mock.go +++ b/internal/pkg/server/catalog-manager/manager_mock.go @@ -50,7 +50,7 @@ func (mr *MockManagerMockRecorder) Add(arg0, arg1, arg2, arg3 interface{}) *gomo } // Download mocks base method. -func (m *MockManager) Download(arg0 string, arg1 bool, arg2 string) ([]*entities.FileInfo, error) { +func (m *MockManager) Download(arg0 string, arg1, arg2 bool) ([]*entities.FileInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Download", arg0, arg1, arg2) ret0, _ := ret[0].([]*entities.FileInfo) @@ -65,7 +65,7 @@ func (mr *MockManagerMockRecorder) Download(arg0, arg1, arg2 interface{}) *gomoc } // Get mocks base method. -func (m *MockManager) Get(arg0, arg1 string) (*entities.ExtendedApplicationMetadata, error) { +func (m *MockManager) Get(arg0 string, arg1 bool) (*entities.ExtendedApplicationMetadata, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", arg0, arg1) ret0, _ := ret[0].(*entities.ExtendedApplicationMetadata) @@ -80,7 +80,7 @@ func (mr *MockManagerMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call { } // List mocks base method. -func (m *MockManager) List(arg0, arg1 string) ([]*entities.AppSummary, error) { +func (m *MockManager) List(arg0 map[string]*bool, arg1 bool) ([]*entities.AppSummary, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "List", arg0, arg1) ret0, _ := ret[0].([]*entities.AppSummary) diff --git a/internal/pkg/server/catalog-manager/manager_test.go b/internal/pkg/server/catalog-manager/manager_test.go index f8e7cbc..cd1dc11 100644 --- a/internal/pkg/server/catalog-manager/manager_test.go +++ b/internal/pkg/server/catalog-manager/manager_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package catalog_manager import ( "fmt" + "github.com/golang/mock/gomock" "github.com/napptive/catalog-manager/internal/pkg/entities" "github.com/napptive/mock-extensions/pkg/matcher" @@ -32,7 +33,7 @@ kind: ApplicationMetadata # Name of the application, not necessarily a valid k8s name. name: "My App Name 2" version: 1.0 -description: Short description for searchs. Long one plus how to goes into the README.md +description: Short description for search. Long one plus how to goes into the README.md # Keywords facilitate searches on the catalog keywords: - "key1" @@ -46,7 +47,7 @@ kind: ApplicationMetadata # Name of the application, not necessarily a valid k8s name. name: "My App Name 2" version: 1.0 -description: Short description for searchs. Long one plus how to goes into the README.md +description: Short description for search. Long one plus how to goes into the README.md # Keywords facilitate searches on the catalog keywords: - "key1" @@ -108,7 +109,33 @@ var _ = ginkgo.Describe("Catalog handler test", func() { }) ginkgo.Context("Downloading applications", func() { - ginkgo.It("Should be able to download an application", func() { + ginkgo.It("Should be able to download a public application", func() { + namespace := "namespace" + appName := "appName" + + filesReturned := []*entities.FileInfo{ + { + Path: "./app.yaml", + Data: []byte("app"), + }, { + Path: "./metadata.yaml", + Data: []byte("metadata"), + }} + + metadataProvider.EXPECT().Get(gomock.Any()).Return(&entities.ApplicationInfo{ + Namespace: namespace, + ApplicationName: appName, + Private: false, + }, nil) + storageProvider.EXPECT().GetApplication(namespace, appName, "latest", false).Return(filesReturned, nil) + + manager := NewManager(storageProvider, metadataProvider, "") + files, err := manager.Download(fmt.Sprintf("%s/%s", namespace, appName), false, true) + gomega.Expect(err).Should(gomega.Succeed()) + gomega.Expect(files).ShouldNot(gomega.BeEmpty()) + gomega.Expect(files).ShouldNot(gomega.BeNil()) + }) + ginkgo.It("Should be able to download a private application if the user can access to the account", func() { namespace := "namespace" appName := "appName" @@ -121,35 +148,82 @@ var _ = ginkgo.Describe("Catalog handler test", func() { Data: []byte("metadata"), }} + metadataProvider.EXPECT().Get(gomock.Any()).Return(&entities.ApplicationInfo{ + Namespace: namespace, + ApplicationName: appName, + Private: true, + }, nil) storageProvider.EXPECT().GetApplication(namespace, appName, "latest", false).Return(filesReturned, nil) manager := NewManager(storageProvider, metadataProvider, "") - files, err := manager.Download(fmt.Sprintf("%s/%s", namespace, appName), false, "") + files, err := manager.Download(fmt.Sprintf("%s/%s", namespace, appName), false, true) gomega.Expect(err).Should(gomega.Succeed()) gomega.Expect(files).ShouldNot(gomega.BeEmpty()) gomega.Expect(files).ShouldNot(gomega.BeNil()) }) + ginkgo.It("Should not be able to download a private application if the user can not access to the account", func() { + namespace := "namespace" + appName := "appName" + + metadataProvider.EXPECT().Get(gomock.Any()).Return(&entities.ApplicationInfo{ + Namespace: namespace, + ApplicationName: appName, + Private: true, + }, nil) + + manager := NewManager(storageProvider, metadataProvider, "") + _, err := manager.Download(fmt.Sprintf("%s/%s", namespace, appName), false, false) + gomega.Expect(err).ShouldNot(gomega.Succeed()) + + }) ginkgo.It("should not be able to download an application with a wrong name", func() { appName := "appName" manager := NewManager(storageProvider, metadataProvider, "") - _, err := manager.Download(appName, false, "") + _, err := manager.Download(appName, false, true) gomega.Expect(err).ShouldNot(gomega.Succeed()) }) ginkgo.It("should not be able to download an application if there is an error in the storage", func() { namespace := "namespace" appName := "appName" + metadataProvider.EXPECT().Get(gomock.Any()).Return(&entities.ApplicationInfo{ + Namespace: namespace, + ApplicationName: appName, + Private: false, + }, nil) storageProvider.EXPECT().GetApplication(namespace, appName, "latest", false).Return(nil, nerrors.NewInternalError("error reading repository")) manager := NewManager(storageProvider, metadataProvider, "") - _, err := manager.Download(fmt.Sprintf("%s/%s", namespace, appName), false, "") + _, err := manager.Download(fmt.Sprintf("%s/%s", namespace, appName), false, true) gomega.Expect(err).ShouldNot(gomega.Succeed()) }) }) ginkgo.Context("Getting application", func() { - ginkgo.It("should be able to get an application", func() { + ginkgo.It("should be able to get a public application", func() { + namespace := "namespace" + appName := "appName" + + matcher := matcher.NewStructMatcher(map[string]interface{}{"Namespace": namespace, "ApplicationName": appName}) + metadataProvider.EXPECT().Get(matcher).Return(&entities.ApplicationInfo{ + CatalogID: "", + Namespace: namespace, + ApplicationName: appName, + Tag: "latest", + MetadataName: "My App", + Metadata: metadataFile, + Private: false, + }, nil) + + manager := NewManager(storageProvider, metadataProvider, "") + metadata, err := manager.Get(fmt.Sprintf("%s/%s", namespace, appName), true) + gomega.Expect(err).Should(gomega.Succeed()) + gomega.Expect(metadata).ShouldNot(gomega.BeNil()) + gomega.Expect(metadata.MetadataObj.Name).ShouldNot(gomega.BeEmpty()) + + }) + ginkgo.It("should be able to get a private application if the user can access to the account", func() { namespace := "namespace" appName := "appName" @@ -161,14 +235,35 @@ var _ = ginkgo.Describe("Catalog handler test", func() { Tag: "latest", MetadataName: "My App", Metadata: metadataFile, + Private: true, }, nil) manager := NewManager(storageProvider, metadataProvider, "") - metadata, err := manager.Get(fmt.Sprintf("%s/%s", namespace, appName), "") + metadata, err := manager.Get(fmt.Sprintf("%s/%s", namespace, appName), true) gomega.Expect(err).Should(gomega.Succeed()) gomega.Expect(metadata).ShouldNot(gomega.BeNil()) gomega.Expect(metadata.MetadataObj.Name).ShouldNot(gomega.BeEmpty()) + }) + ginkgo.It("should not be able to get a private application if the user can not access to the account", func() { + namespace := "namespace" + appName := "appName" + + matcher := matcher.NewStructMatcher(map[string]interface{}{"Namespace": namespace, "ApplicationName": appName}) + metadataProvider.EXPECT().Get(matcher).Return(&entities.ApplicationInfo{ + CatalogID: "", + Namespace: namespace, + ApplicationName: appName, + Tag: "latest", + MetadataName: "My App", + Metadata: metadataFile, + Private: true, + }, nil) + + manager := NewManager(storageProvider, metadataProvider, "") + _, err := manager.Get(fmt.Sprintf("%s/%s", namespace, appName), false) + gomega.Expect(err).ShouldNot(gomega.Succeed()) + }) ginkgo.It("should not be able to return an application if it does not exist", func() { namespace := "namespace" @@ -178,19 +273,19 @@ var _ = ginkgo.Describe("Catalog handler test", func() { metadataProvider.EXPECT().Get(matcher).Return(nil, nerrors.NewNotFoundError("not found")) manager := NewManager(storageProvider, metadataProvider, "") - _, err := manager.Get(fmt.Sprintf("%s/%s", namespace, appName), "") + _, err := manager.Get(fmt.Sprintf("%s/%s", namespace, appName), true) gomega.Expect(err).ShouldNot(gomega.Succeed()) }) ginkgo.It("should not be able to return a invalid application", func() { manager := NewManager(storageProvider, metadataProvider, "") - _, err := manager.Get("invalidApp", "") + _, err := manager.Get("invalidApp", true) gomega.Expect(err).ShouldNot(gomega.Succeed()) }) }) ginkgo.Context("Listing applications", func() { - ginkgo.It("should be able to list applications", func() { + ginkgo.It("should be able to list applications all the public app", func() { returned := []*entities.AppSummary{ { @@ -213,7 +308,7 @@ var _ = ginkgo.Describe("Catalog handler test", func() { metadataProvider.EXPECT().ListSummaryWithFilter(gomock.Any()).Return(returned, &summary, nil) manager := NewManager(storageProvider, metadataProvider, "") - received, err := manager.List("", "") + received, err := manager.List(map[string]*bool{}, true) gomega.Expect(err).Should(gomega.Succeed()) gomega.Expect(received).ShouldNot(gomega.BeEmpty()) gomega.Expect(len(received)).ShouldNot(gomega.BeZero()) @@ -224,11 +319,13 @@ var _ = ginkgo.Describe("Catalog handler test", func() { Namespace: "ns1", ApplicationName: "app1", TagMetadataName: map[string]string{"tag1": "my app v1"}, + Private: false, }, { Namespace: "ns1", ApplicationName: "app1", TagMetadataName: map[string]string{"tag2": "my app v2"}, + Private: false, }, } summary := entities.Summary{ @@ -238,14 +335,14 @@ var _ = ginkgo.Describe("Catalog handler test", func() { } metadataProvider.EXPECT().ListSummaryWithFilter(gomock.Any()).Return(returned, &summary, nil) manager := NewManager(storageProvider, metadataProvider, "") - received, err := manager.List("ns1", "") + received, err := manager.List(map[string]*bool{"ns1": nil}, false) gomega.Expect(err).Should(gomega.Succeed()) gomega.Expect(received).ShouldNot(gomega.BeEmpty()) gomega.Expect(len(received)).Should(gomega.Equal(len(returned))) }) ginkgo.It("should be able to return an empty list of applications", func() { - var returned = []*entities.AppSummary{} + var returned []*entities.AppSummary summary := entities.Summary{ NumNamespaces: 0, NumApplications: 0, @@ -254,7 +351,7 @@ var _ = ginkgo.Describe("Catalog handler test", func() { metadataProvider.EXPECT().ListSummaryWithFilter(gomock.Any()).Return(returned, &summary, nil) manager := NewManager(storageProvider, metadataProvider, "") - received, err := manager.List("", "") + received, err := manager.List(map[string]*bool{"ns1": nil}, false) gomega.Expect(err).Should(gomega.Succeed()) gomega.Expect(received).Should(gomega.BeEmpty()) }) diff --git a/internal/pkg/server/catalog-manager/mocks.go b/internal/pkg/server/catalog-manager/mocks.go index 5c8a43c..1072644 100644 --- a/internal/pkg/server/catalog-manager/mocks.go +++ b/internal/pkg/server/catalog-manager/mocks.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,5 +20,5 @@ package catalog_manager //go:generate mockgen -destination catalog_add_server_mock.go -package=catalog_manager github.com/napptive/grpc-catalog-go Catalog_AddServer //go:generate mockgen -destination manager_mock.go -package=catalog_manager github.com/napptive/catalog-manager/internal/pkg/server/catalog-manager Manager -//Mock is a place holder to unify all mock generators. +// Mock is a place holder to unify all mock generators. func Mock() {} diff --git a/internal/pkg/server/resolver/permission.go b/internal/pkg/server/resolver/permission.go new file mode 100644 index 0000000..2e183a7 --- /dev/null +++ b/internal/pkg/server/resolver/permission.go @@ -0,0 +1,111 @@ +/** + * Copyright 2023 Napptive + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package resolver + +import ( + "context" + + "github.com/napptive/catalog-manager/internal/pkg/config" + "github.com/napptive/catalog-manager/internal/pkg/utils" + "github.com/napptive/njwt/pkg/interceptors" + "github.com/rs/zerolog/log" +) + +// PermissionResolver with a struct to manage account permissions +type PermissionResolver struct { + authEnabled bool + teamConfig config.TeamConfig +} + +// NewPermissionResolver returns a PermissionResolver object +func NewPermissionResolver(authEnabled bool, teamConfig config.TeamConfig) *PermissionResolver { + return &PermissionResolver{ + authEnabled: authEnabled, + teamConfig: teamConfig, + } +} + +// CheckAccountPermissions checks if a user belongs to an account, this is required with the private applications or with certain operations with the public ones +func (pr *PermissionResolver) CheckAccountPermissions(ctx context.Context, applicationName string, requireAdminPrivilege bool) (*bool, error) { + allowed := true + notAllowed := false + + if !pr.authEnabled { + return &allowed, nil + } + + // get the repoName + _, applicationInfo, err := utils.DecomposeApplicationID(applicationName) + if err != nil { + log.Error().Err(err).Str("application_name", applicationName).Msg("error getting application name, unable to check permissions") + return ¬Allowed, err + } + + // getClaim + claim, err := interceptors.GetClaimFromContext(ctx) + if err != nil { + return ¬Allowed, err + } + + namespace := applicationInfo.Namespace + + // If the user is an admin and the namespace is a teamNamespace -> return true + if pr.isPrivilegedUser(claim.Username) && pr.isTeamNamespace(namespace) { + log.Debug().Str("user_id", claim.UserID).Str("username", claim.Username).Str("namespace", namespace). + Msg("Privileged user can operate in a team namespace") + return &allowed, nil + } + + // Check if the user can operate in the requested account + isAuthorized := claim.IsAuthorized(namespace, requireAdminPrivilege) + if isAuthorized { + log.Debug().Str("user_id", claim.UserID).Str("username", claim.Username).Str("namespace", namespace). + Msg("user can operate in the namespace") + } else { + log.Debug().Str("user_id", claim.UserID).Str("username", claim.Username).Str("namespace", namespace). + Msg("user can NOT operate in the namespace") + } + return &isAuthorized, nil +} + +// isTeamNamespace checks the namespace role +func (pr *PermissionResolver) isTeamNamespace(repoName string) bool { + if !pr.teamConfig.Enabled { + return false + } + for _, repo := range pr.teamConfig.TeamNamespaces { + if repo == repoName { + return true + } + } + + return false +} + +// isPrivilegedUser checks the user role +func (pr *PermissionResolver) isPrivilegedUser(userName string) bool { + if !pr.teamConfig.Enabled { + return false + } + for _, user := range pr.teamConfig.PrivilegedUsers { + if user == userName { + return true + } + } + + return false +} diff --git a/internal/pkg/server/users/manager.go b/internal/pkg/server/users/manager.go index 426b5c7..e24c01c 100644 --- a/internal/pkg/server/users/manager.go +++ b/internal/pkg/server/users/manager.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( "time" "github.com/napptive/catalog-manager/internal/pkg/entities" - user_provider "github.com/napptive/catalog-manager/internal/pkg/provider/user-provider" + "github.com/napptive/catalog-manager/internal/pkg/provider/user-provider" "github.com/napptive/catalog-manager/internal/pkg/utils" "github.com/napptive/nerrors/pkg/nerrors" "github.com/napptive/rdbms/v2/pkg/rdbms" diff --git a/internal/pkg/storage/storage_manager.go b/internal/pkg/storage/storage_manager.go index 5a38a75..26cc50a 100644 --- a/internal/pkg/storage/storage_manager.go +++ b/internal/pkg/storage/storage_manager.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/storage/storage_suite_test.go b/internal/pkg/storage/storage_suite_test.go index 76ddb25..1fc981b 100644 --- a/internal/pkg/storage/storage_suite_test.go +++ b/internal/pkg/storage/storage_suite_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/storage/storage_test.go b/internal/pkg/storage/storage_test.go index e5d782d..0ac9367 100644 --- a/internal/pkg/storage/storage_test.go +++ b/internal/pkg/storage/storage_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/utils/helper.go b/internal/pkg/utils/helper.go index d5e819e..f02af0c 100644 --- a/internal/pkg/utils/helper.go +++ b/internal/pkg/utils/helper.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,21 +17,18 @@ package utils import ( + "crypto/rand" "encoding/base32" + "encoding/json" + "sigs.k8s.io/yaml" + "strings" + "github.com/napptive/catalog-manager/internal/pkg/entities" "github.com/napptive/nerrors/pkg/nerrors" "github.com/rs/zerolog/log" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" k8syaml "k8s.io/apimachinery/pkg/runtime/serializer/yaml" - - "crypto/rand" - - "strings" - - "sigs.k8s.io/yaml" - - "encoding/json" ) const ( diff --git a/internal/pkg/utils/helper_test.go b/internal/pkg/utils/helper_test.go index 034fbff..7e805fb 100644 --- a/internal/pkg/utils/helper_test.go +++ b/internal/pkg/utils/helper_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/internal/pkg/utils/test_helper.go b/internal/pkg/utils/test_helper.go index 2ea2b42..205bd71 100644 --- a/internal/pkg/utils/test_helper.go +++ b/internal/pkg/utils/test_helper.go @@ -1,5 +1,5 @@ /** - * Copyright 2020 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,16 +19,14 @@ package utils import ( "context" "fmt" - "os" - "strconv" - "time" - - "github.com/rs/xid" - "github.com/napptive/catalog-manager/internal/pkg/entities" njwthelper "github.com/napptive/njwt/pkg/helper" + njwt "github.com/napptive/njwt/pkg/njwt" + "github.com/rs/xid" "google.golang.org/grpc/metadata" + "os" "syreclabs.com/go/faker" + "time" ) // RunIntegrationTests checks whether integration tests should be executed. @@ -132,37 +130,52 @@ func CreateTestApplicationInfoWithoutLogo() *entities.ApplicationInfo { // after passing the interceptor. The jwt elements allow to test scenarios where // no JWT has been provided in the request. func CreateTestJWTAuthIncomingContext(username string, accountName string, accountAdmin bool, jwtKey string, jwt string) context.Context { - md := metadata.New(map[string]string{ - njwthelper.UserIDKey: GetUserId(), - njwthelper.UsernameKey: username, - njwthelper.AccountIDKey: GetAccountId(), - njwthelper.AccountNameKey: accountName, - njwthelper.EnvironmentIDKey: GetEnvironmentId(), - njwthelper.JWTID: GetTokenId(), - njwthelper.AccountAdminKey: strconv.FormatBool(accountAdmin), - njwthelper.JWTIssuedAt: fmt.Sprint(time.Now().Add(time.Minute * (-30)).Unix()), - jwtKey: jwt, - }) + + userID := GetUserID() + accountID := GetAccountID() + environmentID := GetEnvironmentID() + zoneID := GetZoneID() + role := "Member" + if accountAdmin { + role = "Admin" + } + claim := njwt.NewAuthxClaim(userID, username, accountID, accountName, environmentID, + accountAdmin, zoneID, "zone-test.napptive.dev", + []njwt.UserAccountClaim{njwt.UserAccountClaim{ + Id: accountID, + Name: accountName, + Role: role, + }}) + claimMap := claim.ToMap() + claimMap[jwtKey] = jwt + claimMap[njwthelper.JWTID] = GetTokenID() + claimMap[njwthelper.JWTIssuedAt] = fmt.Sprint(time.Now().Add(time.Minute * (-30)).Unix()) + md := metadata.New(claimMap) parentCtx := context.Background() return metadata.NewIncomingContext(parentCtx, md) } -// GetUserId generates a random UserId -func GetUserId() string { +// GetUserID generates a random UserId +func GetUserID() string { + return xid.New().String() +} + +// GetAccountID generates a random AccountId +func GetAccountID() string { return xid.New().String() } -// GetAccountId generates a random AccountId -func GetAccountId() string { +// GetEnvironmentID generates a random environmentId +func GetEnvironmentID() string { return xid.New().String() } -// GetEnvironmentId generates a random environmentId -func GetEnvironmentId() string { +// GetTokenID generates a random token ID +func GetTokenID() string { return xid.New().String() } -// GetTokenId generates a random token ID -func GetTokenId() string { +// GetZoneID generates a random zone ID +func GetZoneID() string { return xid.New().String() } diff --git a/internal/pkg/utils/utils_suite_test.go b/internal/pkg/utils/utils_suite_test.go index ee3b304..d73c296 100644 --- a/internal/pkg/utils/utils_suite_test.go +++ b/internal/pkg/utils/utils_suite_test.go @@ -1,5 +1,5 @@ /** - * Copyright 2021 Napptive + * Copyright 2023 Napptive * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.