diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e36906e..1b31c89 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,7 @@ repos: hooks: - id: trailing-whitespace - id: detect-private-key + exclude: tokens/testdata/ - repo: https://github.com/google/yamlfmt rev: v0.14.0 hooks: diff --git a/.typos.toml b/.typos.toml index 52a69c0..d8e84f7 100644 --- a/.typos.toml +++ b/.typos.toml @@ -1,5 +1,5 @@ [files] -extend-exclude = ["db","internal/ent/generated/**","go.mod","go.sum","pkg/testutils/","pkg/passwd/","pkg/tokens/testdata/","pkg/tokens/expires_test.go","internal/graphapi/tools_test.go","internal/httpserve/handlers/tools_test.go","pkg/keygen/auth_test.go","pkg/utils/oas/","pkg/keygen/crypto_test.go","pkg/auth/auth_test.go"] +extend-exclude = ["tokens/testdata/**","go.mod","go.sum"] ignore-hidden = true ignore-files = true ignore-dot = true diff --git a/auth/context.go b/auth/context.go index 0d14a12..a7b1a39 100644 --- a/auth/context.go +++ b/auth/context.go @@ -5,6 +5,7 @@ import ( echo "github.com/theopenlane/echox" + "github.com/theopenlane/utils/contextx" "github.com/theopenlane/utils/ulids" "github.com/theopenlane/echox/middleware/echocontext" @@ -87,7 +88,7 @@ func GetAuthenticatedUserContext(c context.Context) (*AuthenticatedUser, error) func AddAuthenticatedUserContext(c echo.Context, user *AuthenticatedUser) context.Context { c.Set(ContextAuthenticatedUser.name, user) - ctx := context.WithValue(c.Request().Context(), echocontext.EchoContextKey, c) + ctx := contextx.With(c.Request().Context(), c) c.SetRequest(c.Request().WithContext(ctx)) diff --git a/auth/context_test.go b/auth/context_test.go index 9218576..6ce0aad 100644 --- a/auth/context_test.go +++ b/auth/context_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/theopenlane/echox/middleware/echocontext" + "github.com/theopenlane/utils/contextx" "github.com/theopenlane/utils/ulids" "github.com/theopenlane/iam/auth" @@ -16,7 +17,7 @@ func TestGetSubjectIDFromContext(t *testing.T) { // context with no user set ec := echocontext.NewTestEchoContext() - basicContext := context.WithValue(ec.Request().Context(), echocontext.EchoContextKey, ec) + basicContext := contextx.With(ec.Request().Context(), ec) ec.SetRequest(ec.Request().WithContext(basicContext)) @@ -75,7 +76,7 @@ func TestGetOrganizationIDFromContext(t *testing.T) { // context with no user set ec := echocontext.NewTestEchoContext() - basicContext := context.WithValue(ec.Request().Context(), echocontext.EchoContextKey, ec) + basicContext := contextx.With(ec.Request().Context(), ec) ec.SetRequest(ec.Request().WithContext(basicContext)) @@ -136,7 +137,7 @@ func TestGetSubscriptionFromContext(t *testing.T) { ec := echocontext.NewTestEchoContext() - basicContext := context.WithValue(ec.Request().Context(), echocontext.EchoContextKey, ec) + basicContext := contextx.With(ec.Request().Context(), ec) ec.SetRequest(ec.Request().WithContext(basicContext)) diff --git a/auth/test_tools.go b/auth/test_tools.go index 8da4fa9..f14654f 100644 --- a/auth/test_tools.go +++ b/auth/test_tools.go @@ -7,6 +7,7 @@ import ( "github.com/golang-jwt/jwt/v5" echo "github.com/theopenlane/echox" "github.com/theopenlane/echox/middleware/echocontext" + "github.com/theopenlane/utils/contextx" "github.com/theopenlane/utils/ulids" "github.com/theopenlane/iam/tokens" @@ -55,7 +56,7 @@ func NewTestContextWithValidUser(subject string) (context.Context, error) { return nil, err } - reqCtx := context.WithValue(ec.Request().Context(), echocontext.EchoContextKey, ec) + reqCtx := contextx.With(ec.Request().Context(), ec) ec.SetRequest(ec.Request().WithContext(reqCtx)) @@ -106,7 +107,7 @@ func NewTestContextWithOrgID(sub, orgID string) (context.Context, error) { return nil, err } - reqCtx := context.WithValue(ec.Request().Context(), echocontext.EchoContextKey, ec) + reqCtx := contextx.With(ec.Request().Context(), ec) ec.SetRequest(ec.Request().WithContext(reqCtx)) @@ -137,7 +138,7 @@ func NewTestContextWithSubscription(subscription bool) (context.Context, error) return nil, err } - reqCtx := context.WithValue(ec.Request().Context(), echocontext.EchoContextKey, ec) + reqCtx := contextx.With(ec.Request().Context(), ec) ec.SetRequest(ec.Request().WithContext(reqCtx)) diff --git a/go.mod b/go.mod index a441a70..6d8d5aa 100644 --- a/go.mod +++ b/go.mod @@ -5,14 +5,14 @@ go 1.23.3 require ( entgo.io/contrib v0.6.0 entgo.io/ent v0.14.1 - github.com/99designs/gqlgen v0.17.61 + github.com/99designs/gqlgen v0.17.62 github.com/Yamashou/gqlgenc v0.30.2 github.com/alicebob/miniredis/v2 v2.34.0 github.com/brianvoe/gofakeit/v7 v7.1.2 - github.com/coreos/go-oidc/v3 v3.11.0 + github.com/coreos/go-oidc/v3 v3.12.0 github.com/go-webauthn/webauthn v0.11.2 github.com/golang-jwt/jwt/v5 v5.2.1 - github.com/google/go-github/v67 v67.0.0 + github.com/google/go-github/v68 v68.0.0 github.com/gorilla/securecookie v1.1.2 github.com/lestrrat-go/jwx/v2 v2.1.3 github.com/oklog/ulid/v2 v2.1.0 @@ -28,11 +28,11 @@ require ( github.com/stretchr/testify v1.10.0 github.com/testcontainers/testcontainers-go v0.34.0 github.com/testcontainers/testcontainers-go/modules/openfga v0.34.0 - github.com/theopenlane/echox v0.2.0 + github.com/theopenlane/echox v0.2.1 github.com/theopenlane/utils v0.4.2 github.com/vmihailenco/msgpack/v5 v5.4.1 golang.org/x/oauth2 v0.25.0 - golang.org/x/tools v0.28.0 + golang.org/x/tools v0.29.0 google.golang.org/api v0.214.0 google.golang.org/protobuf v1.36.1 ) @@ -154,7 +154,7 @@ require ( github.com/urfave/cli/v2 v2.27.5 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect - github.com/vektah/gqlparser/v2 v2.5.20 // indirect + github.com/vektah/gqlparser/v2 v2.5.21 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect @@ -169,12 +169,12 @@ require ( go.opentelemetry.io/otel/trace v1.33.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.31.0 // indirect + golang.org/x/crypto v0.32.0 // indirect golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect golang.org/x/mod v0.22.0 // indirect - golang.org/x/net v0.33.0 // indirect + golang.org/x/net v0.34.0 // indirect golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect + golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.8.0 // indirect gonum.org/v1/gonum v0.15.1 // indirect diff --git a/go.sum b/go.sum index 9c2bcb8..6325279 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ entgo.io/contrib v0.6.0 h1:xfo4TbJE7sJZWx7BV7YrpSz7IPFvS8MzL3fnfzZjKvQ= entgo.io/contrib v0.6.0/go.mod h1:3qWIseJ/9Wx2Hu5zVh15FDzv7d/UvKNcYKdViywWCQg= entgo.io/ent v0.14.1 h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s= entgo.io/ent v0.14.1/go.mod h1:MH6XLG0KXpkcDQhKiHfANZSzR55TJyPL5IGNpI8wpco= -github.com/99designs/gqlgen v0.17.61 h1:vE7xLRC066n9wehgjeplILOWtwz75zbzcV2/Iv9i3pw= -github.com/99designs/gqlgen v0.17.61/go.mod h1:rFU1T3lhv/tPeAlww/DJ4ol2YxT/pPpue+xxPbkd3r4= +github.com/99designs/gqlgen v0.17.62 h1:Wovt1+XJN9dTWYh92537Y9a5FuMVSkrQL4bn0a8v5Rg= +github.com/99designs/gqlgen v0.17.62/go.mod h1:sVCM2iwIZisJjTI/DEC3fpH+HFgxY1496ZJ+jbT9IjA= github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk= github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= @@ -69,8 +69,8 @@ github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= -github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI= -github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0= +github.com/coreos/go-oidc/v3 v3.12.0 h1:sJk+8G2qq94rDI6ehZ71Bol3oUHy63qNYmkiSjrc/Jo= +github.com/coreos/go-oidc/v3 v3.12.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= @@ -143,8 +143,8 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ 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/go-github/v67 v67.0.0 h1:g11NDAmfaBaCO8qYdI9fsmbaRipHNWRIU/2YGvlh4rg= -github.com/google/go-github/v67 v67.0.0/go.mod h1:zH3K7BxjFndr9QSeFibx4lTKkYS3K9nDanoI1NjaOtY= +github.com/google/go-github/v68 v68.0.0 h1:ZW57zeNZiXTdQ16qrDiZ0k6XucrxZ2CGmoTvcCyQG6s= +github.com/google/go-github/v68 v68.0.0/go.mod h1:K9HAUBovM2sLwM408A18h+wd9vqdLOEqTUCbnRIcx68= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/go-tpm v0.9.1 h1:0pGc4X//bAlmZzMKf8iz6IsDo1nYTbYJ6FZN/rg4zdM= @@ -342,8 +342,8 @@ github.com/testcontainers/testcontainers-go v0.34.0 h1:5fbgF0vIN5u+nD3IWabQwRybu github.com/testcontainers/testcontainers-go v0.34.0/go.mod h1:6P/kMkQe8yqPHfPWNulFGdFHTD8HB2vLq/231xY2iPQ= github.com/testcontainers/testcontainers-go/modules/openfga v0.34.0 h1:Y5ZFzu6eANOViDjXFxAdyu+68LMQdok9GUdQJiwVjp0= github.com/testcontainers/testcontainers-go/modules/openfga v0.34.0/go.mod h1:0IWpmPSJOXpAUCHLgbhiE1fTOR69XJ/rnbdiQfkwLfc= -github.com/theopenlane/echox v0.2.0 h1:s9DJJrsLOSPsXVfgmQxgXmSVtxzztBnSmcVX4ax7tIM= -github.com/theopenlane/echox v0.2.0/go.mod h1:nfxwQpwvqYYI/pFHJKDs3/HLvjYKEGCih4XDgLSma64= +github.com/theopenlane/echox v0.2.1 h1:ZhVkimmWxpKITf67oM57SrLWeIdnV8+dNXlC+VzlRaQ= +github.com/theopenlane/echox v0.2.1/go.mod h1:4j/Hx0uoLk5gVzdA83Qqz7xBEmqpoEP+OnzVaw2p6/o= github.com/theopenlane/utils v0.4.2 h1:f72oSi3lQj05QRZKiqqSSqy4RY4Wgy1qIRv3RGjftVE= github.com/theopenlane/utils v0.4.2/go.mod h1:rGGqAI6hxDZVAUB+kmp7HOzD9RmHnsH6K/nr9QQgsTs= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= @@ -356,8 +356,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vektah/gqlparser/v2 v2.5.20 h1:kPaWbhBntxoZPaNdBaIPT1Kh0i1b/onb5kXgEdP5JCo= -github.com/vektah/gqlparser/v2 v2.5.20/go.mod h1:xMl+ta8a5M1Yo1A1Iwt/k7gSpscwSnHZdw7tfhEGfTM= +github.com/vektah/gqlparser/v2 v2.5.21 h1:Zw1rG2dr1pRR4wqwbVq4d6+xk2f4ut/yo+hwr4QjE08= +github.com/vektah/gqlparser/v2 v2.5.21/go.mod h1:xMl+ta8a5M1Yo1A1Iwt/k7gSpscwSnHZdw7tfhEGfTM= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= @@ -411,8 +411,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -423,8 +423,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -445,10 +445,10 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.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/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= @@ -459,8 +459,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= -golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= +golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/providers/github/client.go b/providers/github/client.go index c2e5918..f9c5ad4 100644 --- a/providers/github/client.go +++ b/providers/github/client.go @@ -5,7 +5,7 @@ import ( "net/http" "net/url" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v68/github" ) // ClientConfig holds the configuration for the GitHub client @@ -100,8 +100,8 @@ func (u *UsersMock) Get(context.Context, string) (*github.User, *github.Response resp := &http.Response{StatusCode: http.StatusOK} return &github.User{ - Login: github.String("antman"), - ID: github.Int64(1), + Login: github.Ptr("antman"), + ID: github.Ptr(int64(1)), }, &github.Response{Response: resp}, nil } @@ -111,12 +111,12 @@ func (u *UsersMock) ListEmails(ctx context.Context, opts *github.ListOptions) ([ return []*github.UserEmail{ { - Email: github.String("antman@theopenlane.io"), - Primary: github.Bool(true), + Email: github.Ptr("antman@theopenlane.io"), + Primary: github.Ptr(true), }, { - Email: github.String("ant-man@avengers.com"), - Primary: github.Bool(false), + Email: github.Ptr("ant-man@avengers.com"), + Primary: github.Ptr(false), }, }, &github.Response{Response: resp}, nil } diff --git a/providers/github/context.go b/providers/github/context.go index d93574f..15ed052 100644 --- a/providers/github/context.go +++ b/providers/github/context.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v68/github" ) // unexported key type prevents collisions diff --git a/providers/github/context_test.go b/providers/github/context_test.go index 39b32e3..f8c88ec 100644 --- a/providers/github/context_test.go +++ b/providers/github/context_test.go @@ -4,14 +4,14 @@ import ( "context" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v68/github" "github.com/stretchr/testify/assert" ) func TestContextUser(t *testing.T) { expectedUser := &github.User{ - ID: github.Int64(917408), - Name: github.String("Meow Meowingtonr"), + ID: github.Ptr(int64(917408)), + Name: github.Ptr("Meow Meowingtonr"), } ctx := WithUser(context.Background(), expectedUser) user, err := UserFromContext(ctx) diff --git a/providers/github/login.go b/providers/github/login.go index 81eb02c..baf11f9 100644 --- a/providers/github/login.go +++ b/providers/github/login.go @@ -5,7 +5,7 @@ import ( "net/http" "net/url" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v68/github" "golang.org/x/oauth2" oauth2Login "github.com/theopenlane/iam/providers/oauth2" diff --git a/providers/github/login_test.go b/providers/github/login_test.go index 57ba62f..8424e0f 100644 --- a/providers/github/login_test.go +++ b/providers/github/login_test.go @@ -11,7 +11,7 @@ import ( oauth2Login "github.com/theopenlane/iam/providers/oauth2" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v68/github" "github.com/stretchr/testify/assert" "golang.org/x/oauth2" ) @@ -27,9 +27,9 @@ func TestGithubHandler(t *testing.T) { emailJSONData := `[{"primary": true, "email": "sfunk@meow.net"}, {"primary": false, "email": "sfunk@woof.net"}]` expectedUser := &github.User{ - ID: github.Int64(917408), - Name: github.String("Sarah Funkytown"), - Email: github.String("sfunk@meow.net"), + ID: github.Ptr(int64(917408)), + Name: github.Ptr("Sarah Funkytown"), + Email: github.Ptr("sfunk@meow.net"), } proxyClient, server := newGithubTestServer("", jsonData, emailJSONData) @@ -122,9 +122,9 @@ func TestGithubEnterprise(t *testing.T) { jsonData := `{"id": 917408, "name": "Sarah Funkytown"}` emailJSONData := `[{"primary": true, "email": "sfunk@meow.net"}, {"primary": false, "email": "sfunk@woof.net"}]` expectedUser := &github.User{ - ID: github.Int64(917408), - Name: github.String("Sarah Funkytown"), - Email: github.String("sfunk@meow.net"), + ID: github.Ptr(int64(917408)), + Name: github.Ptr("Sarah Funkytown"), + Email: github.Ptr("sfunk@meow.net"), } proxyClient, server := newGithubTestServer("/api/v3", jsonData, emailJSONData) @@ -160,7 +160,7 @@ func TestGithubEnterprise(t *testing.T) { } func TestValidateResponse(t *testing.T) { - validUser := &github.User{ID: github.Int64(123)} + validUser := &github.User{ID: github.Ptr(int64(123))} validResponse := &github.Response{Response: &http.Response{StatusCode: 200}} invalidResponse := &github.Response{Response: &http.Response{StatusCode: 500}} diff --git a/sessions/redisstore.go b/sessions/redisstore.go index 39ae99b..dc68e21 100644 --- a/sessions/redisstore.go +++ b/sessions/redisstore.go @@ -19,7 +19,7 @@ type PersistentStore interface { var _ PersistentStore = &persistentStore{} -// persistentStore stores Sessions in a persisent data store (redis) +// persistentStore stores Sessions in a persistent data store (redis) type persistentStore struct { client *redis.Client mu sync.Mutex diff --git a/totp/testing/templates/totp.html b/totp/testing/templates/totp.html index 30a5481..7508cd8 100644 --- a/totp/testing/templates/totp.html +++ b/totp/testing/templates/totp.html @@ -57,7 +57,7 @@

Generated Key:

Secret Key

{{ .key }}

QR Code

- QR code + QR code

TOTP

{{ .generateTOTP }}