Skip to content

Commit

Permalink
Merge pull request #424 from jhernand/use_jwt_fork
Browse files Browse the repository at this point in the history
Use `golang-jwt/jwt` instead of `dgrijalva/jwt-go`
  • Loading branch information
jhernand authored Aug 10, 2021
2 parents 31b8336 + 7c5b0ee commit 624dde3
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 7 deletions.
26 changes: 26 additions & 0 deletions CHANGES.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
This document describes the relevant changes between releases of the OCM API
SDK.

== 0.1.199 TBD

- Use `golang-jwt/jwt` instead of `dgrijalva/jwt-go`.
+
The `dgrijalva/jwt-go` library is no longer maintained and `golang-jwt/jwt` is
a community maintained fork. See https://github.com/dgrijalva/jwt-go/issues/462
for detailts.
+
Parts of the public interface of the SDK use this library, so this is a
backwards compatibility breaking change. Projects using the SDK will need to
switch to the new library, specially if they are using the
`context.ContextWithToken` or `context.TokenFromContext` functions. The change
should only require changing the import paths, as the fork is fully compatible
with the original library.
+
A simple way to do the required changes is the following command:
+
....
$ find . -name '*.go' | xargs sed -i 's|dgrijalva/jwt-go|golang-jwt/jwt|'
....
+
This also addresses
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26160[CVE-2020-26160],
but that vulnerability doesn't currently affect the SDK because the
authentication handler doesn't use the `aud` claim.

== 0.1.198 Aug 03 2021

- Update model to v0.0.139:
Expand Down
2 changes: 1 addition & 1 deletion authentication/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"context"
"fmt"

"github.com/dgrijalva/jwt-go"
"github.com/golang-jwt/jwt"
)

// ContextWithToken creates a new context containing the given token.
Expand Down
2 changes: 1 addition & 1 deletion authentication/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (
"sync"
"time"

"github.com/dgrijalva/jwt-go"
"github.com/ghodss/yaml"
"github.com/golang-jwt/jwt"

"github.com/openshift-online/ocm-sdk-go/errors"
"github.com/openshift-online/ocm-sdk-go/logging"
Expand Down
2 changes: 1 addition & 1 deletion authentication/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"os"
"time"

"github.com/dgrijalva/jwt-go"
"github.com/golang-jwt/jwt"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" // nolint
Expand Down
2 changes: 1 addition & 1 deletion authentication/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"time"

"github.com/dgrijalva/jwt-go"
"github.com/golang-jwt/jwt"
)

// tokenRemaining determines if the given token will eventually expire (offile access tokens, for
Expand Down
2 changes: 1 addition & 1 deletion authentication/transport_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

//
"github.com/cenkalti/backoff/v4"
jwt "github.com/dgrijalva/jwt-go"
jwt "github.com/golang-jwt/jwt"
"github.com/openshift-online/ocm-sdk-go/internal"
"github.com/openshift-online/ocm-sdk-go/logging"
"github.com/prometheus/client_golang/prometheus"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.14

require (
github.com/cenkalti/backoff/v4 v4.0.0
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/ghodss/yaml v1.0.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/google/uuid v1.2.0
github.com/jackc/pgconn v1.9.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
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 h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down
2 changes: 1 addition & 1 deletion testing/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"net/http"
"time"

"github.com/dgrijalva/jwt-go"
"github.com/golang-jwt/jwt"

. "github.com/onsi/gomega" // nolint
)
Expand Down

0 comments on commit 624dde3

Please sign in to comment.