Skip to content

Commit 83f22d8

Browse files
authored
Replace JWT lib (#307)
* Replace JWT lib * Upgrade Go to 1.15 * Fix condition on go version * Fix tooling install * Flag tool dependencies behind build tag
1 parent db7294f commit 83f22d8

21 files changed

+88
-26
lines changed

.github/workflows/test.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
on:
22
push:
33
branches: [master]
4-
tags: ['*']
4+
tags: ["*"]
55
pull_request:
66
types: [opened, synchronize, reopened]
77
name: Test
88
jobs:
99
test:
1010
strategy:
1111
matrix:
12-
go-version: [1.13.x, 1.14.x]
12+
go-version: [1.15.x, 1.16.x]
1313
runs-on: ubuntu-latest
1414
services:
1515
mysql:
@@ -36,7 +36,7 @@ jobs:
3636
- name: Trigger CircleCI for deployment
3737
env:
3838
CIRCLE_API_USER_TOKEN: ${{ secrets.CIRCLE_API_USER_TOKEN }}
39-
if: ${{ matrix.go-version == '1.13.x' && env.CIRCLE_API_USER_TOKEN != null }}
39+
if: ${{ matrix.go-version == '1.15.x' && env.CIRCLE_API_USER_TOKEN != null }}
4040
run: |
4141
REF="${GITHUB_HEAD_REF:-main}"
4242
curl -X POST --silent --show-error --fail \

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.13-alpine as build
1+
FROM golang:1.15-alpine as build
22
ENV GO111MODULE=on
33
ENV CGO_ENABLED=0
44
ENV GOOS=linux

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ build: ## Build the binary.
1010
go build -ldflags "-X github.com/netlify/gotrue/cmd.Version=`git rev-parse HEAD`"
1111

1212
deps: ## Install dependencies.
13-
@go get github.com/gobuffalo/pop/[email protected]
1413
@go install github.com/gobuffalo/pop/soda
15-
@go get -u golang.org/x/lint/golint
14+
@go install golang.org/x/lint/golint
1615
@go mod download
1716

1817
image: ## Build the Docker image.

api/admin_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"testing"
1010
"time"
1111

12-
jwt "github.com/dgrijalva/jwt-go"
12+
"github.com/gobuffalo/uuid"
13+
jwt "github.com/golang-jwt/jwt/v4"
1314
"github.com/netlify/gotrue/conf"
1415
"github.com/netlify/gotrue/models"
15-
"github.com/gobuffalo/uuid"
1616
"github.com/stretchr/testify/assert"
1717
"github.com/stretchr/testify/require"
1818
"github.com/stretchr/testify/suite"

api/audit_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
"testing"
99
"time"
1010

11-
jwt "github.com/dgrijalva/jwt-go"
11+
"github.com/gobuffalo/uuid"
12+
jwt "github.com/golang-jwt/jwt/v4"
1213
"github.com/netlify/gotrue/conf"
1314
"github.com/netlify/gotrue/models"
14-
"github.com/gobuffalo/uuid"
1515
"github.com/stretchr/testify/assert"
1616
"github.com/stretchr/testify/require"
1717
"github.com/stretchr/testify/suite"

api/auth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"encoding/json"
66
"net/http"
77

8-
jwt "github.com/dgrijalva/jwt-go"
8+
jwt "github.com/golang-jwt/jwt/v4"
99
)
1010

1111
// requireAuthentication checks incoming requests for tokens presented using the Authorization header

api/context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package api
33
import (
44
"context"
55

6-
jwt "github.com/dgrijalva/jwt-go"
76
"github.com/gobuffalo/uuid"
7+
jwt "github.com/golang-jwt/jwt/v4"
88
"github.com/netlify/gotrue/conf"
99
"github.com/netlify/gotrue/models"
1010
)

api/external.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"strings"
1010
"time"
1111

12-
jwt "github.com/dgrijalva/jwt-go"
1312
"github.com/gobuffalo/uuid"
13+
jwt "github.com/golang-jwt/jwt/v4"
1414
"github.com/netlify/gotrue/api/provider"
1515
"github.com/netlify/gotrue/models"
1616
"github.com/netlify/gotrue/storage"

api/external_bitbucket_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http/httptest"
77
"net/url"
88

9-
jwt "github.com/dgrijalva/jwt-go"
9+
jwt "github.com/golang-jwt/jwt/v4"
1010
)
1111

1212
func (ts *ExternalTestSuite) TestSignupExternalBitbucket() {

api/external_facebook_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http/httptest"
77
"net/url"
88

9-
jwt "github.com/dgrijalva/jwt-go"
9+
jwt "github.com/golang-jwt/jwt/v4"
1010
)
1111

1212
func (ts *ExternalTestSuite) TestSignupExternalFacebook() {

api/external_github_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http/httptest"
77
"net/url"
88

9-
jwt "github.com/dgrijalva/jwt-go"
9+
jwt "github.com/golang-jwt/jwt/v4"
1010
)
1111

1212
func (ts *ExternalTestSuite) TestSignupExternalGithub() {

api/external_gitlab_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http/httptest"
77
"net/url"
88

9-
jwt "github.com/dgrijalva/jwt-go"
9+
jwt "github.com/golang-jwt/jwt/v4"
1010
)
1111

1212
func (ts *ExternalTestSuite) TestSignupExternalGitlab() {

api/external_google_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/http/httptest"
77
"net/url"
88

9-
jwt "github.com/dgrijalva/jwt-go"
9+
jwt "github.com/golang-jwt/jwt/v4"
1010
)
1111

1212
func (ts *ExternalTestSuite) TestSignupExternalGoogle() {

api/hooks.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"net/url"
1414
"time"
1515

16-
jwt "github.com/dgrijalva/jwt-go"
1716
"github.com/gobuffalo/uuid"
17+
jwt "github.com/golang-jwt/jwt/v4"
1818
"github.com/pkg/errors"
1919
"github.com/sirupsen/logrus"
2020

api/invite_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"testing"
1111
"time"
1212

13-
jwt "github.com/dgrijalva/jwt-go"
1413
"github.com/gobuffalo/uuid"
14+
jwt "github.com/golang-jwt/jwt/v4"
1515
"github.com/netlify/gotrue/conf"
1616
"github.com/netlify/gotrue/models"
1717
"github.com/stretchr/testify/assert"

api/middleware.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
"io/ioutil"
99
"net/http"
1010

11-
jwt "github.com/dgrijalva/jwt-go"
1211
"github.com/didip/tollbooth/v5"
1312
"github.com/didip/tollbooth/v5/limiter"
1413
"github.com/gobuffalo/uuid"
14+
jwt "github.com/golang-jwt/jwt/v4"
1515
"github.com/netlify/gotrue/models"
1616
)
1717

api/signup_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"testing"
1010
"time"
1111

12-
jwt "github.com/dgrijalva/jwt-go"
1312
"github.com/gobuffalo/uuid"
13+
jwt "github.com/golang-jwt/jwt/v4"
1414
"github.com/netlify/gotrue/conf"
1515
"github.com/netlify/gotrue/models"
1616
"github.com/stretchr/testify/assert"

api/token.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/http"
66
"time"
77

8-
jwt "github.com/dgrijalva/jwt-go"
8+
jwt "github.com/golang-jwt/jwt/v4"
99
"github.com/netlify/gotrue/conf"
1010
"github.com/netlify/gotrue/metering"
1111
"github.com/netlify/gotrue/models"

go.mod

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ require (
44
github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20170623214735-571947b0f240
55
github.com/badoux/checkmail v0.0.0-20170203135005-d0a759655d62
66
github.com/beevik/etree v1.1.1-0.20200718192613-4a2f8b9d084c
7-
github.com/dgrijalva/jwt-go v3.2.0+incompatible
7+
github.com/cockroachdb/cockroach-go v2.0.1+incompatible // indirect
88
github.com/didip/tollbooth/v5 v5.1.1
99
github.com/go-chi/chi v4.0.2+incompatible
1010
github.com/go-sql-driver/mysql v1.5.0
11+
github.com/gobuffalo/genny v0.6.0 // indirect
12+
github.com/gobuffalo/pop v4.13.1+incompatible
1113
github.com/gobuffalo/pop/v5 v5.3.1
1214
github.com/gobuffalo/uuid v2.0.5+incompatible
15+
github.com/gobuffalo/validate v2.0.4+incompatible // indirect
16+
github.com/golang-jwt/jwt/v4 v4.1.0
1317
github.com/imdario/mergo v0.0.0-20160216103600-3e95a51e0639
1418
github.com/joho/godotenv v1.3.0
1519
github.com/kelseyhightower/envconfig v1.4.0
@@ -26,6 +30,7 @@ require (
2630
github.com/spf13/pflag v1.0.5 // indirect
2731
github.com/stretchr/testify v1.6.1
2832
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
33+
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
2934
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
3035
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
3136
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect
@@ -44,4 +49,4 @@ replace (
4449
github.com/russellhaering/goxmldsig => github.com/russellhaering/goxmldsig v1.1.1
4550
)
4651

47-
go 1.13
52+
go 1.15

0 commit comments

Comments
 (0)