From 7a71987c49fb7c1b95136fbe9fe7b3f3adb093a3 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Tue, 8 Mar 2022 17:12:38 +0500 Subject: [PATCH 1/6] Fixing JWT security warning. --- go.mod | 2 +- go.sum | 3 ++- pkg/jwtauth/jwtauth.go | 5 +++-- pkg/jwtauth/jwtauth_test.go | 5 +++-- pkg/middleware/auth.go | 2 +- pkg/middleware/auth_test.go | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 0dcd8bd3..15b28279 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,13 @@ go 1.13 require ( github.com/VividCortex/gohistogram v1.0.0 // indirect - github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/go-chi/chi v4.1.1+incompatible github.com/go-chi/cors v1.1.1 github.com/go-chi/httplog v0.1.6 github.com/go-chi/render v1.0.1 github.com/go-kit/kit v0.9.0 github.com/go-redis/redis/v8 v8.11.4 + github.com/golang-jwt/jwt v3.2.2+incompatible github.com/google/uuid v1.1.1 github.com/lestrrat-go/jwx v0.9.0 github.com/optimizely/go-sdk v1.8.0 diff --git a/go.sum b/go.sum index f31cd1a3..375b228d 100644 --- a/go.sum +++ b/go.sum @@ -21,7 +21,6 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= @@ -50,6 +49,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go index 63f11bdc..4461a2c2 100644 --- a/pkg/jwtauth/jwtauth.go +++ b/pkg/jwtauth/jwtauth.go @@ -21,10 +21,11 @@ import ( "crypto/rand" "encoding/base64" "fmt" - "golang.org/x/crypto/bcrypt" "time" - "github.com/dgrijalva/jwt-go" + "golang.org/x/crypto/bcrypt" + + "github.com/golang-jwt/jwt" ) // BuildAPIAccessToken returns a token for accessing the API service using the argument SDK keys and TTL. It also returns the expiration timestamp. diff --git a/pkg/jwtauth/jwtauth_test.go b/pkg/jwtauth/jwtauth_test.go index 7c2ca7ee..c5923925 100644 --- a/pkg/jwtauth/jwtauth_test.go +++ b/pkg/jwtauth/jwtauth_test.go @@ -19,10 +19,11 @@ package jwtauth import ( "encoding/base64" - "github.com/dgrijalva/jwt-go" - "github.com/stretchr/testify/suite" "testing" "time" + + "github.com/golang-jwt/jwt" + "github.com/stretchr/testify/suite" ) type JWTAuthTestSuite struct { diff --git a/pkg/middleware/auth.go b/pkg/middleware/auth.go index d2ce07dd..9c162b4a 100644 --- a/pkg/middleware/auth.go +++ b/pkg/middleware/auth.go @@ -28,7 +28,7 @@ import ( "github.com/optimizely/agent/config" "github.com/optimizely/agent/pkg/jwtauth" - "github.com/dgrijalva/jwt-go" + "github.com/golang-jwt/jwt" "github.com/lestrrat-go/jwx/jwk" "github.com/rs/zerolog/log" ) diff --git a/pkg/middleware/auth_test.go b/pkg/middleware/auth_test.go index d985235a..28af1a27 100644 --- a/pkg/middleware/auth_test.go +++ b/pkg/middleware/auth_test.go @@ -27,7 +27,7 @@ import ( "github.com/optimizely/agent/config" - "github.com/dgrijalva/jwt-go" + "github.com/golang-jwt/jwt" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) From 73674295711945f12a29eb3d604e918130e8d335 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Tue, 8 Mar 2022 17:28:38 +0500 Subject: [PATCH 2/6] fixes. --- go.mod | 4 ++-- go.sum | 4 ++-- pkg/jwtauth/jwtauth.go | 2 +- pkg/jwtauth/jwtauth_test.go | 2 +- pkg/middleware/auth.go | 2 +- pkg/middleware/auth_test.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 15b28279..87bfd0fb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/optimizely/agent -go 1.13 +go 1.15 require ( github.com/VividCortex/gohistogram v1.0.0 // indirect @@ -10,7 +10,7 @@ require ( github.com/go-chi/render v1.0.1 github.com/go-kit/kit v0.9.0 github.com/go-redis/redis/v8 v8.11.4 - github.com/golang-jwt/jwt v3.2.2+incompatible + github.com/golang-jwt/jwt/v4 v4.3.0 github.com/google/uuid v1.1.1 github.com/lestrrat-go/jwx v0.9.0 github.com/optimizely/go-sdk v1.8.0 diff --git a/go.sum b/go.sum index 375b228d..c7d36526 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= +github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go index 4461a2c2..0bd18407 100644 --- a/pkg/jwtauth/jwtauth.go +++ b/pkg/jwtauth/jwtauth.go @@ -25,7 +25,7 @@ import ( "golang.org/x/crypto/bcrypt" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" ) // BuildAPIAccessToken returns a token for accessing the API service using the argument SDK keys and TTL. It also returns the expiration timestamp. diff --git a/pkg/jwtauth/jwtauth_test.go b/pkg/jwtauth/jwtauth_test.go index c5923925..b463f5e1 100644 --- a/pkg/jwtauth/jwtauth_test.go +++ b/pkg/jwtauth/jwtauth_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/stretchr/testify/suite" ) diff --git a/pkg/middleware/auth.go b/pkg/middleware/auth.go index 9c162b4a..ed88d7c8 100644 --- a/pkg/middleware/auth.go +++ b/pkg/middleware/auth.go @@ -28,7 +28,7 @@ import ( "github.com/optimizely/agent/config" "github.com/optimizely/agent/pkg/jwtauth" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/lestrrat-go/jwx/jwk" "github.com/rs/zerolog/log" ) diff --git a/pkg/middleware/auth_test.go b/pkg/middleware/auth_test.go index 28af1a27..fe1e61ee 100644 --- a/pkg/middleware/auth_test.go +++ b/pkg/middleware/auth_test.go @@ -27,7 +27,7 @@ import ( "github.com/optimizely/agent/config" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) From f10e992a569ab638acbe48a490bb654beaef8fd8 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Tue, 8 Mar 2022 17:40:18 +0500 Subject: [PATCH 3/6] updating go version to 1.15.x --- .travis.yml | 4 ++-- Makefile | 2 +- README.md | 2 +- .../deploy-as-a-microservice/020 - setup-optimizely-agent.md | 2 +- .../deploy-as-a-microservice/020 - setup-optimizely-agent.md | 2 +- pkg/middleware/cached.go | 2 +- scripts/build.ps1 | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f77956b..70c8a018 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ language: shell env: global: # GO VERSION is set here with GIMME_GO_VERSION see: https://github.com/travis-ci/gimme - # may also want to run `go mod edit -go=1.13` to fix go.mod as well - - GIMME_GO_VERSION=1.13.x GIMME_OS=linux GIMME_ARCH=amd64 + # may also want to run `go mod edit -go=1.15` to fix go.mod as well + - GIMME_GO_VERSION=1.15.x GIMME_OS=linux GIMME_ARCH=amd64 branches: only: diff --git a/Makefile b/Makefile index 9b988301..d29b0e54 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ build: $(TARGET) check-go ## builds and installs binary in bin/ check-go: ifndef GOPATH - $(error "go is not available please install golang version 1.13+, https://golang.org/dl/") + $(error "go is not available please install golang version 1.15+, https://golang.org/dl/") endif clean: check-go ## runs `go clean` and removes the bin/ dir diff --git a/README.md b/README.md index b48f38e2..da7dc9b6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Optimizely Full Stack is A/B testing and feature flag management for product dev To get started with Optimizely Agent, follow the [Quickstart guide](https://docs.developers.optimizely.com/full-stack/docs/) and view example usage in our [examples folder](./examples). ## Prerequisites -Optimizely Agent is implemented in [Golang](https://golang.org/). Golang version 1.13+ is required for developing and compiling from source. +Optimizely Agent is implemented in [Golang](https://golang.org/). Golang version 1.15+ is required for developing and compiling from source. Installers and binary archives for most platforms can be downloaded directly from the Go [downloads](https://golang.org/dl/) page. ## Running from source (Linux / OSX) diff --git a/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md b/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md index 23de9d44..e9d86dc7 100644 --- a/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md +++ b/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md @@ -12,7 +12,7 @@ updatedAt: "2020-03-31T23:54:17.841Z" To develop and compile Optimizely Agent from source: -1. Install [Golang](https://golang.org/dl/) version 1.13+ . +1. Install [Golang](https://golang.org/dl/) version 1.15+ . 2. Clone the [Optimizely Agent repo](https://github.com/optimizely/agent). 3. From the repo directory, open a terminal and start Optimizely Agent: diff --git a/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md b/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md index d71d59ed..38d2e44d 100644 --- a/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md +++ b/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md @@ -12,7 +12,7 @@ updatedAt: "2021-03-15T23:02:34.056Z" To develop and compile Optimizely Agent from source: -1. Install [Golang](https://golang.org/dl/) version 1.13+ . +1. Install [Golang](https://golang.org/dl/) version 1.15+ . 2. Clone the [Optimizely Agent repo](https://github.com/optimizely/agent). 3. From the repo directory, open a terminal and start Optimizely Agent: diff --git a/pkg/middleware/cached.go b/pkg/middleware/cached.go index 9afe6a3b..0368f2ac 100644 --- a/pkg/middleware/cached.go +++ b/pkg/middleware/cached.go @@ -75,7 +75,7 @@ func (mw *CachedOptlyMiddleware) ClientCtx(next http.Handler) http.Handler { GetLogger(r).Error().Err(err).Msg("Initializing OptimizelyClient") switch { - // Check if error indicates a 403 from the CDN. Ideally we'd use errors.Is(), but the go-sdk isn't 1.13 + // Check if error indicates a 403 from the CDN. Ideally we'd use errors.Is(), but the go-sdk isn't 1.15 case strings.Contains(err.Error(), "403"): RenderError(err, http.StatusForbidden, w, r) case errors.Is(err, optimizely.ErrValidationFailure): diff --git a/scripts/build.ps1 b/scripts/build.ps1 index adb2a4be..d44ba9d9 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -101,7 +101,7 @@ function main($mode) { # noninteractive mode: ./build.ps1 noninteractive (default: interactive) # check if go is installed, if not, install it. - checkPrereq 'Go Programming Language amd64 go1.13.5' https://dl.google.com/go/go1.13.5.windows-amd64.msi eabcf66d6d8f44de21a96a18d957990c62f21d7fadcb308a25c6b58c79ac2b96 $mode + checkPrereq 'Go Programming Language amd64 go1.15.15' https://dl.google.com/go/go1.15.15.windows-amd64.msi eabcf66d6d8f44de21a96a18d957990c62f21d7fadcb308a25c6b58c79ac2b96 $mode # same but with git checkPrereq 'Git version 2.24.1.2' https://github.com/git-for-windows/git/releases/download/v2.24.1.windows.2/Git-2.24.1.2-64-bit.exe 34e484936105713e7d0c2f421bf62e4cfe652f6638a9ecb5df2186c1918753e2 $mode From bde34dadea0ddb84f7be89d66bfc185c59a23c4b Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Tue, 8 Mar 2022 18:42:35 +0500 Subject: [PATCH 4/6] fixes. --- scripts/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index d44ba9d9..f7e054b2 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -101,7 +101,7 @@ function main($mode) { # noninteractive mode: ./build.ps1 noninteractive (default: interactive) # check if go is installed, if not, install it. - checkPrereq 'Go Programming Language amd64 go1.15.15' https://dl.google.com/go/go1.15.15.windows-amd64.msi eabcf66d6d8f44de21a96a18d957990c62f21d7fadcb308a25c6b58c79ac2b96 $mode + checkPrereq 'Go Programming Language amd64 go1.15.15' https://dl.google.com/go/go1.15.15.windows-amd64.msi C76656A253CC4C7A0BA7AE006CADC0BF2D6DF7066ACB8DF84460EAC94DC3A7D1 $mode # same but with git checkPrereq 'Git version 2.24.1.2' https://github.com/git-for-windows/git/releases/download/v2.24.1.windows.2/Git-2.24.1.2-64-bit.exe 34e484936105713e7d0c2f421bf62e4cfe652f6638a9ecb5df2186c1918753e2 $mode From 9807a03b17315e1e757be93378d1b736276f1fc0 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Wed, 9 Mar 2022 13:14:00 +0500 Subject: [PATCH 5/6] reverting to go 1.13 --- .travis.yml | 4 ++-- Makefile | 2 +- README.md | 2 +- .../deploy-as-a-microservice/020 - setup-optimizely-agent.md | 2 +- .../deploy-as-a-microservice/020 - setup-optimizely-agent.md | 2 +- go.mod | 4 ++-- go.sum | 4 ++-- pkg/jwtauth/jwtauth.go | 2 +- pkg/jwtauth/jwtauth_test.go | 2 +- pkg/middleware/auth.go | 2 +- pkg/middleware/auth_test.go | 2 +- pkg/middleware/cached.go | 2 +- scripts/build.ps1 | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 70c8a018..0f77956b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ language: shell env: global: # GO VERSION is set here with GIMME_GO_VERSION see: https://github.com/travis-ci/gimme - # may also want to run `go mod edit -go=1.15` to fix go.mod as well - - GIMME_GO_VERSION=1.15.x GIMME_OS=linux GIMME_ARCH=amd64 + # may also want to run `go mod edit -go=1.13` to fix go.mod as well + - GIMME_GO_VERSION=1.13.x GIMME_OS=linux GIMME_ARCH=amd64 branches: only: diff --git a/Makefile b/Makefile index d29b0e54..9b988301 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ build: $(TARGET) check-go ## builds and installs binary in bin/ check-go: ifndef GOPATH - $(error "go is not available please install golang version 1.15+, https://golang.org/dl/") + $(error "go is not available please install golang version 1.13+, https://golang.org/dl/") endif clean: check-go ## runs `go clean` and removes the bin/ dir diff --git a/README.md b/README.md index da7dc9b6..b48f38e2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Optimizely Full Stack is A/B testing and feature flag management for product dev To get started with Optimizely Agent, follow the [Quickstart guide](https://docs.developers.optimizely.com/full-stack/docs/) and view example usage in our [examples folder](./examples). ## Prerequisites -Optimizely Agent is implemented in [Golang](https://golang.org/). Golang version 1.15+ is required for developing and compiling from source. +Optimizely Agent is implemented in [Golang](https://golang.org/). Golang version 1.13+ is required for developing and compiling from source. Installers and binary archives for most platforms can be downloaded directly from the Go [downloads](https://golang.org/dl/) page. ## Running from source (Linux / OSX) diff --git a/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md b/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md index e9d86dc7..23de9d44 100644 --- a/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md +++ b/docs/readme-sync/v3.1/deploy-as-a-microservice/020 - setup-optimizely-agent.md @@ -12,7 +12,7 @@ updatedAt: "2020-03-31T23:54:17.841Z" To develop and compile Optimizely Agent from source: -1. Install [Golang](https://golang.org/dl/) version 1.15+ . +1. Install [Golang](https://golang.org/dl/) version 1.13+ . 2. Clone the [Optimizely Agent repo](https://github.com/optimizely/agent). 3. From the repo directory, open a terminal and start Optimizely Agent: diff --git a/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md b/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md index 38d2e44d..d71d59ed 100644 --- a/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md +++ b/docs/readme-sync/v4.0/deploy-as-a-microservice/020 - setup-optimizely-agent.md @@ -12,7 +12,7 @@ updatedAt: "2021-03-15T23:02:34.056Z" To develop and compile Optimizely Agent from source: -1. Install [Golang](https://golang.org/dl/) version 1.15+ . +1. Install [Golang](https://golang.org/dl/) version 1.13+ . 2. Clone the [Optimizely Agent repo](https://github.com/optimizely/agent). 3. From the repo directory, open a terminal and start Optimizely Agent: diff --git a/go.mod b/go.mod index 87bfd0fb..8e31b227 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/optimizely/agent -go 1.15 +go 1.13 require ( github.com/VividCortex/gohistogram v1.0.0 // indirect @@ -10,7 +10,7 @@ require ( github.com/go-chi/render v1.0.1 github.com/go-kit/kit v0.9.0 github.com/go-redis/redis/v8 v8.11.4 - github.com/golang-jwt/jwt/v4 v4.3.0 + github.com/golang-jwt/jwt v3.2.1+incompatible github.com/google/uuid v1.1.1 github.com/lestrrat-go/jwx v0.9.0 github.com/optimizely/go-sdk v1.8.0 diff --git a/go.sum b/go.sum index c7d36526..6376afdf 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= -github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go index 0bd18407..4461a2c2 100644 --- a/pkg/jwtauth/jwtauth.go +++ b/pkg/jwtauth/jwtauth.go @@ -25,7 +25,7 @@ import ( "golang.org/x/crypto/bcrypt" - "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt" ) // BuildAPIAccessToken returns a token for accessing the API service using the argument SDK keys and TTL. It also returns the expiration timestamp. diff --git a/pkg/jwtauth/jwtauth_test.go b/pkg/jwtauth/jwtauth_test.go index b463f5e1..c5923925 100644 --- a/pkg/jwtauth/jwtauth_test.go +++ b/pkg/jwtauth/jwtauth_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt" "github.com/stretchr/testify/suite" ) diff --git a/pkg/middleware/auth.go b/pkg/middleware/auth.go index ed88d7c8..9c162b4a 100644 --- a/pkg/middleware/auth.go +++ b/pkg/middleware/auth.go @@ -28,7 +28,7 @@ import ( "github.com/optimizely/agent/config" "github.com/optimizely/agent/pkg/jwtauth" - "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt" "github.com/lestrrat-go/jwx/jwk" "github.com/rs/zerolog/log" ) diff --git a/pkg/middleware/auth_test.go b/pkg/middleware/auth_test.go index fe1e61ee..28af1a27 100644 --- a/pkg/middleware/auth_test.go +++ b/pkg/middleware/auth_test.go @@ -27,7 +27,7 @@ import ( "github.com/optimizely/agent/config" - "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) diff --git a/pkg/middleware/cached.go b/pkg/middleware/cached.go index 0368f2ac..9afe6a3b 100644 --- a/pkg/middleware/cached.go +++ b/pkg/middleware/cached.go @@ -75,7 +75,7 @@ func (mw *CachedOptlyMiddleware) ClientCtx(next http.Handler) http.Handler { GetLogger(r).Error().Err(err).Msg("Initializing OptimizelyClient") switch { - // Check if error indicates a 403 from the CDN. Ideally we'd use errors.Is(), but the go-sdk isn't 1.15 + // Check if error indicates a 403 from the CDN. Ideally we'd use errors.Is(), but the go-sdk isn't 1.13 case strings.Contains(err.Error(), "403"): RenderError(err, http.StatusForbidden, w, r) case errors.Is(err, optimizely.ErrValidationFailure): diff --git a/scripts/build.ps1 b/scripts/build.ps1 index f7e054b2..7841a3ee 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -101,7 +101,7 @@ function main($mode) { # noninteractive mode: ./build.ps1 noninteractive (default: interactive) # check if go is installed, if not, install it. - checkPrereq 'Go Programming Language amd64 go1.15.15' https://dl.google.com/go/go1.15.15.windows-amd64.msi C76656A253CC4C7A0BA7AE006CADC0BF2D6DF7066ACB8DF84460EAC94DC3A7D1 $mode + checkPrereq 'Go Programming Language amd64 go1.13.15' https://dl.google.com/go/go1.13.15.windows-amd64.msi eabcf66d6d8f44de21a96a18d957990c62f21d7fadcb308a25c6b58c79ac2b96 $mode # same but with git checkPrereq 'Git version 2.24.1.2' https://github.com/git-for-windows/git/releases/download/v2.24.1.windows.2/Git-2.24.1.2-64-bit.exe 34e484936105713e7d0c2f421bf62e4cfe652f6638a9ecb5df2186c1918753e2 $mode From ccbf72d77919cbb165216c9d9c43595b5c460990 Mon Sep 17 00:00:00 2001 From: Yasir Ali Date: Wed, 9 Mar 2022 13:15:49 +0500 Subject: [PATCH 6/6] fixes. --- scripts/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 7841a3ee..adb2a4be 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -101,7 +101,7 @@ function main($mode) { # noninteractive mode: ./build.ps1 noninteractive (default: interactive) # check if go is installed, if not, install it. - checkPrereq 'Go Programming Language amd64 go1.13.15' https://dl.google.com/go/go1.13.15.windows-amd64.msi eabcf66d6d8f44de21a96a18d957990c62f21d7fadcb308a25c6b58c79ac2b96 $mode + checkPrereq 'Go Programming Language amd64 go1.13.5' https://dl.google.com/go/go1.13.5.windows-amd64.msi eabcf66d6d8f44de21a96a18d957990c62f21d7fadcb308a25c6b58c79ac2b96 $mode # same but with git checkPrereq 'Git version 2.24.1.2' https://github.com/git-for-windows/git/releases/download/v2.24.1.windows.2/Git-2.24.1.2-64-bit.exe 34e484936105713e7d0c2f421bf62e4cfe652f6638a9ecb5df2186c1918753e2 $mode