Skip to content

Commit 7c5b0ee

Browse files
committed
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 dgrijalva/jwt-go#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 CVE-2020-26160, but that vulnerability doesn't currently affect the SDK because the authentication handler doesn't use the `aud` claim. Related: openshift-online#421 Related: dgrijalva/jwt-go#462 Related: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26160 Signed-off-by: Juan Hernandez <[email protected]>
1 parent 31b8336 commit 7c5b0ee

9 files changed

+35
-7
lines changed

CHANGES.adoc

+26
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@
33
This document describes the relevant changes between releases of the OCM API
44
SDK.
55

6+
== 0.1.199 TBD
7+
8+
- Use `golang-jwt/jwt` instead of `dgrijalva/jwt-go`.
9+
+
10+
The `dgrijalva/jwt-go` library is no longer maintained and `golang-jwt/jwt` is
11+
a community maintained fork. See https://github.com/dgrijalva/jwt-go/issues/462
12+
for detailts.
13+
+
14+
Parts of the public interface of the SDK use this library, so this is a
15+
backwards compatibility breaking change. Projects using the SDK will need to
16+
switch to the new library, specially if they are using the
17+
`context.ContextWithToken` or `context.TokenFromContext` functions. The change
18+
should only require changing the import paths, as the fork is fully compatible
19+
with the original library.
20+
+
21+
A simple way to do the required changes is the following command:
22+
+
23+
....
24+
$ find . -name '*.go' | xargs sed -i 's|dgrijalva/jwt-go|golang-jwt/jwt|'
25+
....
26+
+
27+
This also addresses
28+
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26160[CVE-2020-26160],
29+
but that vulnerability doesn't currently affect the SDK because the
30+
authentication handler doesn't use the `aud` claim.
31+
632
== 0.1.198 Aug 03 2021
733

834
- Update model to v0.0.139:

authentication/context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"context"
2323
"fmt"
2424

25-
"github.com/dgrijalva/jwt-go"
25+
"github.com/golang-jwt/jwt"
2626
)
2727

2828
// ContextWithToken creates a new context containing the given token.

authentication/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ import (
3535
"sync"
3636
"time"
3737

38-
"github.com/dgrijalva/jwt-go"
3938
"github.com/ghodss/yaml"
39+
"github.com/golang-jwt/jwt"
4040

4141
"github.com/openshift-online/ocm-sdk-go/errors"
4242
"github.com/openshift-online/ocm-sdk-go/logging"

authentication/handler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"os"
2626
"time"
2727

28-
"github.com/dgrijalva/jwt-go"
28+
"github.com/golang-jwt/jwt"
2929

3030
. "github.com/onsi/ginkgo"
3131
. "github.com/onsi/gomega" // nolint

authentication/helpers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"fmt"
2323
"time"
2424

25-
"github.com/dgrijalva/jwt-go"
25+
"github.com/golang-jwt/jwt"
2626
)
2727

2828
// tokenRemaining determines if the given token will eventually expire (offile access tokens, for

authentication/transport_wrapper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535

3636
//
3737
"github.com/cenkalti/backoff/v4"
38-
jwt "github.com/dgrijalva/jwt-go"
38+
jwt "github.com/golang-jwt/jwt"
3939
"github.com/openshift-online/ocm-sdk-go/internal"
4040
"github.com/openshift-online/ocm-sdk-go/logging"
4141
"github.com/prometheus/client_golang/prometheus"

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ go 1.14
44

55
require (
66
github.com/cenkalti/backoff/v4 v4.0.0
7-
github.com/dgrijalva/jwt-go v3.2.0+incompatible
87
github.com/ghodss/yaml v1.0.0
8+
github.com/golang-jwt/jwt v3.2.2+incompatible
99
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
1010
github.com/google/uuid v1.2.0
1111
github.com/jackc/pgconn v1.9.0

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
101101
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
102102
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
103103
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
104+
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
105+
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
104106
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
105107
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
106108
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=

testing/tokens.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"net/http"
2525
"time"
2626

27-
"github.com/dgrijalva/jwt-go"
27+
"github.com/golang-jwt/jwt"
2828

2929
. "github.com/onsi/gomega" // nolint
3030
)

0 commit comments

Comments
 (0)