diff --git a/.golangci.yaml b/.golangci.yaml index 499a4b8..b47c3fb 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -66,3 +66,86 @@ linters-settings: - ca *testcerts.CertificateAuthority lll: line-length: 160 + revive: + rules: + - name: argument-limit + arguments: [ 6 ] + - name: atomic + - name: bare-return + - name: blank-imports + - name: bool-literal-in-expr + - name: call-to-gc + - name: comment-spacings + arguments: + - "nolint:" + - name: confusing-naming + #- name: confusing-results + - name: constant-logical-expr + - name: context-as-argument + - name: context-keys-type + - name: datarace + - name: deep-exit + - name: defer + - name: dot-imports + - name: duplicated-imports + - name: early-return + - name: empty-block + - name: empty-lines + - name: enforce-map-style + arguments: [ "make" ] + exclude: [ "TEST" ] + - name: enforce-repeated-arg-type-style + arguments: [ "short" ] + - name: enforce-slice-style + arguments: [ "make" ] + - name: error-naming + - name: error-return + - name: error-strings + - name: errorf + #- name: function-result-limit + # arguments: [ 3 ] + - name: get-return + - name: identical-branches + - name: if-return + - name: import-alias-naming + - name: import-shadowing + - name: increment-decrement + - name: indent-error-flow + # Enable again when https://github.com/mgechev/revive/issues/1103 is fixed + # - name: max-public-structs + # exclude: [ "TEST" ] + # arguments: [ 5 ] + - name: modifies-parameter + - name: modifies-value-receiver + - name: optimize-operands-order + - name: package-comments + - name: range + - name: range-val-address + - name: range-val-in-closure + - name: receiver-naming + - name: redefines-builtin-id + - name: redundant-import-alias + - name: string-format + arguments: + - - 'fmt.Errorf[0],errors.New[0]' + - '/^([^A-Z]|$)/' + - 'Error string must not start with a capital letter.' + - - 'fmt.Errorf[0],errors.New[0]' + - '/(^|[^\.!?])$/' + - 'Error string must not end in punctuation.' + - - 'panic' + - '/^[^\n]*$/' + - 'Must not contain line breaks.' + - name: string-of-int + - name: struct-tag + - name: superfluous-else + - name: time-equal + - name: time-naming + - name: unconditional-recursion + - name: unexported-naming + - name: unnecessary-stmt + - name: unreachable-code + - name: unused-parameter + - name: var-declaration + - name: var-naming + - name: waitgroup-by-value diff --git a/cmd/daemon/root.go b/cmd/daemon/root.go index e3881b5..9746deb 100644 --- a/cmd/daemon/root.go +++ b/cmd/daemon/root.go @@ -114,7 +114,7 @@ func Execute(args []string, logWriter io.Writer, version, commit, date string) i defer wg.Done() if err := openvpnClient.Connect(); err != nil { - cancel(fmt.Errorf("OpenVPN: %w", err)) + cancel(fmt.Errorf("openvpn: %w", err)) return } diff --git a/docs/Non-interactive session refresh.md b/docs/Non-interactive session refresh.md index 4c893e0..81438bc 100644 --- a/docs/Non-interactive session refresh.md +++ b/docs/Non-interactive session refresh.md @@ -6,7 +6,7 @@ This means users must log in interactively each time they authenticate, includin However, you can change this behavior by enabling the `oauth2.refresh.enabled=true` setting. This allows `openvpn-auth-oauth2` to store either the connection ID or SessionID (`oauth2.refresh.use-session-id=true`), -accepting connections without additional login checks. SessionIDs are availible in OpenVPN, if +accepting connections without additional login checks. SessionIDs are available in OpenVPN, if `auth-gen-token [lifetime] external-auth` is configured on server side. When `oauth2.refresh.validate-user=true` is set, `openvpn-auth-oauth2` diff --git a/go.mod b/go.mod index dfb8f00..ab72291 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.10.0 github.com/zitadel/logging v0.6.1 github.com/zitadel/oidc/v3 v3.33.1 - golang.org/x/net v0.32.0 + golang.org/x/net v0.33.0 golang.org/x/oauth2 v0.24.0 golang.org/x/text v0.21.0 ) @@ -24,7 +24,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect - github.com/go-chi/chi/v5 v5.1.0 // indirect + github.com/go-chi/chi/v5 v5.2.0 // indirect github.com/go-jose/go-jose/v4 v4.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -39,10 +39,11 @@ require ( github.com/rs/cors v1.11.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/zitadel/schema v1.3.0 // indirect - go.opentelemetry.io/otel v1.32.0 // indirect - go.opentelemetry.io/otel/metric v1.32.0 // indirect - go.opentelemetry.io/otel/trace v1.32.0 // indirect - golang.org/x/crypto v0.30.0 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel v1.33.0 // indirect + go.opentelemetry.io/otel/metric v1.33.0 // indirect + go.opentelemetry.io/otel/trace v1.33.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/sys v0.28.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1114e0c..ae580cb 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= -github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.2.0 h1:Aj1EtB0qR2Rdo2dG4O94RIU35w2lvQSj6BRA4+qwFL0= +github.com/go-chi/chi/v5 v5.2.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E= github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -44,8 +44,8 @@ github.com/knadh/koanf/providers/structs v0.1.0 h1:wJRteCNn1qvLtE5h8KQBvLJovidSd github.com/knadh/koanf/providers/structs v0.1.0/go.mod h1:sw2YZ3txUcqA3Z27gPlmmBzWn1h8Nt9O6EP/91MkcWE= github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/madflojo/testcerts v1.3.0 h1:H6r7WlzfeLqzcuOglfAlnj5Rkt5iQoH1ctTi7FsLOdE= @@ -60,6 +60,8 @@ github.com/muhlemmer/httpforwarded v0.1.0 h1:x4DLrzXdliq8mprgUMR0olDvHGkou5BJsK/ github.com/muhlemmer/httpforwarded v0.1.0/go.mod h1:yo9czKedo2pdZhoXe+yDkGVbU0TJ0q9oQ90BVoDEtw0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -74,16 +76,18 @@ github.com/zitadel/oidc/v3 v3.33.1 h1:e3w9PDV0Mh50/ZiJWtzyT0E4uxJ6RXll+hqVDnqGbT github.com/zitadel/oidc/v3 v3.33.1/go.mod h1:zkoZ1Oq6CweX3BaLrftLEGCs6YK6zDpjjVGZrP10AWU= github.com/zitadel/schema v1.3.0 h1:kQ9W9tvIwZICCKWcMvCEweXET1OcOyGEuFbHs4o5kg0= github.com/zitadel/schema v1.3.0/go.mod h1:NptN6mkBDFvERUCvZHlvWmmME+gmZ44xzwRXwhzsbtc= -go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= -go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= -go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= -go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= -go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= -go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= -golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= -golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= +go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= +go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ= +go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M= +go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= +go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= +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/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/go.work.sum b/go.work.sum index e4d093d..0767ed9 100644 --- a/go.work.sum +++ b/go.work.sum @@ -515,6 +515,7 @@ github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.11.0 h1:jtLewhRR2vMRNnq2ZZUoCjUlgut+Y0+sDDWPOfwOi1o= github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 24d2f85..1682570 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -74,7 +74,7 @@ var Defaults = Config{ Expires: time.Hour * 8, ValidateUser: true, }, - Scopes: []string{}, + Scopes: make([]string, 0), Validate: OAuth2Validate{ Groups: make([]string, 0), IPAddr: false, diff --git a/internal/config/url.go b/internal/config/url.go index 73e08dc..fab3bff 100644 --- a/internal/config/url.go +++ b/internal/config/url.go @@ -2,6 +2,6 @@ package config import "net/url" -func IsURLEmpty(url *url.URL) bool { - return url == nil || url.String() == "" +func IsURLEmpty(u *url.URL) bool { + return u == nil || u.String() == "" } diff --git a/internal/oauth2/handler_test.go b/internal/oauth2/handler_test.go index 1ed205b..bae7932 100644 --- a/internal/oauth2/handler_test.go +++ b/internal/oauth2/handler_test.go @@ -52,7 +52,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -83,7 +83,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -117,7 +117,7 @@ func TestHandler(t *testing.T) { PKCE: true, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -149,7 +149,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -180,7 +180,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -212,7 +212,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -244,7 +244,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -276,7 +276,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -308,7 +308,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, @@ -340,7 +340,7 @@ func TestHandler(t *testing.T) { }, }, OpenVpn: config.OpenVpn{ - Bypass: config.OpenVpnBypass{CommonNames: []string{}}, + Bypass: config.OpenVpnBypass{CommonNames: make([]string, 0)}, AuthTokenUser: true, }, }, diff --git a/internal/oauth2/provider.go b/internal/oauth2/provider.go index ad44041..89ef03e 100644 --- a/internal/oauth2/provider.go +++ b/internal/oauth2/provider.go @@ -165,10 +165,10 @@ func (p *Provider) getProviderOptions(basePath *url.URL) []rp.Option { rp.WithAuthStyle(p.conf.OAuth2.AuthStyle.AuthStyle()), rp.WithHTTPClient(p.httpClient), rp.WithErrorHandler(func(w http.ResponseWriter, _ *http.Request, errorType string, errorDesc string, encryptedSession string) { - errorHandler(w, p.conf, p.logger, p.openvpn, http.StatusInternalServerError, errorType, errorDesc, encryptedSession) + p.errorHandler(w, http.StatusInternalServerError, errorType, errorDesc, encryptedSession) }), rp.WithUnauthorizedHandler(func(w http.ResponseWriter, _ *http.Request, desc string, encryptedSession string) { - errorHandler(w, p.conf, p.logger, p.openvpn, http.StatusUnauthorized, "Unauthorized", desc, encryptedSession) + p.errorHandler(w, http.StatusUnauthorized, "Unauthorized", desc, encryptedSession) }), rp.WithSigningAlgsFromDiscovery(), } @@ -226,24 +226,24 @@ func newOidcProvider(ctx context.Context, conf config.Config, httpClient *http.C return provider, nil } -func errorHandler( - w http.ResponseWriter, conf config.Config, logger *slog.Logger, openvpn OpenVPN, - httpStatus int, errorType string, errorDesc string, encryptedSession string, +func (p *Provider) errorHandler( + w http.ResponseWriter, + httpStatus int, errorType, errorDesc, encryptedSession string, ) { - session, err := state.NewWithEncodedToken(encryptedSession, conf.HTTP.Secret.String()) + session, err := state.NewWithEncodedToken(encryptedSession, p.conf.HTTP.Secret.String()) if err == nil { - logger = logger.With( + logger := p.logger.With( slog.String("ip", fmt.Sprintf("%s:%s", session.IPAddr, session.IPPort)), slog.Uint64("cid", session.Client.CID), slog.Uint64("kid", session.Client.KID), slog.String("common_name", session.CommonName), ) - openvpn.DenyClient(logger, session.Client, "client rejected") + p.openvpn.DenyClient(logger, session.Client, "client rejected") } else { - logger.Debug("errorHandler: " + err.Error()) + p.logger.Debug("errorHandler: " + err.Error()) } - writeError(w, logger, conf, httpStatus, errorType, errorDesc) + writeError(w, p.logger, p.conf, httpStatus, errorType, errorDesc) } func (p *Provider) GetNonce(id string) string { diff --git a/internal/oauth2/providers/generic/check_test.go b/internal/oauth2/providers/generic/check_test.go index 1c50e3c..3d696e5 100644 --- a/internal/oauth2/providers/generic/check_test.go +++ b/internal/oauth2/providers/generic/check_test.go @@ -137,12 +137,12 @@ func TestValidateGroups(t *testing.T) { requiredGroups []string err string }{ - {"groups not present", nil, []string{}, ""}, - {"groups empty", []string{}, []string{}, ""}, - {"groups present", []string{"apple"}, []string{}, ""}, + {"groups not present", nil, make([]string, 0), ""}, + {"groups empty", make([]string, 0), make([]string, 0), ""}, + {"groups present", []string{"apple"}, make([]string, 0), ""}, {"configure one group", []string{"apple"}, []string{"apple"}, ""}, {"configure one group, groups not present", nil, []string{"apple"}, "missing claim: groups"}, - {"configure two group, none match", []string{}, []string{"apple", "pear"}, generic.ErrMissingRequiredGroup.Error()}, + {"configure two group, none match", make([]string, 0), []string{"apple", "pear"}, generic.ErrMissingRequiredGroup.Error()}, {"configure two group, missing one", []string{"apple"}, []string{"apple", "pear"}, ""}, {"configure two group", []string{"apple", "pear"}, []string{"apple", "pear"}, ""}, } { @@ -187,12 +187,12 @@ func TestValidateRoles(t *testing.T) { requiredRoles []string err string }{ - {"groups not present", nil, []string{}, ""}, - {"groups empty", []string{}, []string{}, ""}, - {"groups present", []string{"apple"}, []string{}, ""}, + {"groups not present", nil, make([]string, 0), ""}, + {"groups empty", make([]string, 0), make([]string, 0), ""}, + {"groups present", []string{"apple"}, make([]string, 0), ""}, {"configure one role", []string{"apple"}, []string{"apple"}, ""}, {"configure one role, role not present", nil, []string{"apple"}, "missing claim: roles"}, - {"configure two role, none match", []string{}, []string{"apple", "pear"}, generic.ErrMissingRequiredRole.Error()}, + {"configure two role, none match", make([]string, 0), []string{"apple", "pear"}, generic.ErrMissingRequiredRole.Error()}, {"configure two role, missing one", []string{"apple"}, []string{"apple", "pear"}, ""}, {"configure two role", []string{"apple", "pear"}, []string{"apple", "pear"}, ""}, } { diff --git a/internal/oauth2/providers/github/api.go b/internal/oauth2/providers/github/api.go index 928613a..94f8d48 100644 --- a/internal/oauth2/providers/github/api.go +++ b/internal/oauth2/providers/github/api.go @@ -18,7 +18,7 @@ var ( reLast = regexp.MustCompile("<([^>]+)>; rel=\"last\"") ) -func get[T any](ctx context.Context, httpClient *http.Client, accessToken string, apiURL string, data *T) (string, error) { +func get[T any](ctx context.Context, httpClient *http.Client, accessToken, apiURL string, data *T) (string, error) { req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiURL, nil) if err != nil { return "", fmt.Errorf("error creating request context with URL %s: %w", apiURL, err) @@ -56,12 +56,12 @@ func getPagination(apiURL string, resp *http.Response) string { } links := resp.Header.Get("Link") - if len(reLast.FindStringSubmatch(links)) > 1 { - lastPageURL := reLast.FindStringSubmatch(links)[1] - if apiURL == lastPageURL { - return "" - } - } else { + if len(reLast.FindStringSubmatch(links)) == 0 { + return "" + } + + lastPageURL := reLast.FindStringSubmatch(links)[1] + if apiURL == lastPageURL { return "" } diff --git a/internal/oauth2/providers/github/check.go b/internal/oauth2/providers/github/check.go index c735102..1cd2472 100644 --- a/internal/oauth2/providers/github/check.go +++ b/internal/oauth2/providers/github/check.go @@ -24,7 +24,7 @@ type teamType struct { // CheckUser implements the [github.com/jkroepke/openvpn-auth-oauth2/internal/oauth2.Provider] interface. // It checks if mets specific GitHub related conditions. func (p *Provider) CheckUser( - ctx context.Context, state state.State, userData types.UserData, tokens *oidc.Tokens[*idtoken.Claims], + ctx context.Context, sessionState state.State, userData types.UserData, tokens *oidc.Tokens[*idtoken.Claims], ) error { //nolint:exhaustruct tokens.IDTokenClaims = &idtoken.Claims{} @@ -47,7 +47,7 @@ func (p *Provider) CheckUser( tokens.IDTokenClaims.Roles = teams } - return p.Provider.CheckUser(ctx, state, userData, tokens) //nolint:wrapcheck + return p.Provider.CheckUser(ctx, sessionState, userData, tokens) //nolint:wrapcheck } // getTeams fetch the users GitHub team by accessing the GitHub API. diff --git a/internal/oauth2/providers/github/check_test.go b/internal/oauth2/providers/github/check_test.go index db33419..7a99067 100644 --- a/internal/oauth2/providers/github/check_test.go +++ b/internal/oauth2/providers/github/check_test.go @@ -34,13 +34,13 @@ func TestValidateGroups(t *testing.T) { { "empty", `[]`, - []string{}, + make([]string, 0), "", }, { "present", `[{ "login": "apple" }]`, - []string{}, + make([]string, 0), "", }, { @@ -148,13 +148,13 @@ func TestValidateRoles(t *testing.T) { { "empty", `[]`, - []string{}, + make([]string, 0), "", }, { "present", `[{ "slug": "justice-league", "organization": { "login": "apple" }}]`, - []string{}, + make([]string, 0), "", }, { diff --git a/internal/oauth2/providers/github/user_test.go b/internal/oauth2/providers/github/user_test.go index f322feb..57120cb 100644 --- a/internal/oauth2/providers/github/user_test.go +++ b/internal/oauth2/providers/github/user_test.go @@ -73,8 +73,8 @@ func TestGetUser(t *testing.T) { conf := config.Config{ OAuth2: config.OAuth2{ Validate: config.OAuth2Validate{ - Groups: []string{}, - Roles: []string{}, + Groups: make([]string, 0), + Roles: make([]string, 0), }, }, } diff --git a/internal/oauth2/providers/google/check.go b/internal/oauth2/providers/google/check.go index dfe8ca8..30443d8 100644 --- a/internal/oauth2/providers/google/check.go +++ b/internal/oauth2/providers/google/check.go @@ -17,7 +17,7 @@ func (p *Provider) CheckUser( tokens *oidc.Tokens[*idtoken.Claims], ) error { if len(p.Conf.OAuth2.Validate.Groups) > 0 { - tokens.IDTokenClaims.Groups = []string{} + tokens.IDTokenClaims.Groups = make([]string, 0) if tokens.AccessToken == "" { return errors.New("access token is empty") diff --git a/internal/oauth2/providers/google/check_test.go b/internal/oauth2/providers/google/check_test.go index 87689ff..89b9fbd 100644 --- a/internal/oauth2/providers/google/check_test.go +++ b/internal/oauth2/providers/google/check_test.go @@ -32,25 +32,25 @@ func TestValidateGroups(t *testing.T) { { "groups not present", `{"memberships": [], "nextPageToken": ""}`, - []string{}, + make([]string, 0), "", }, { "groups empty", `{"memberships": [], "nextPageToken": ""}`, - []string{}, + make([]string, 0), "", }, { "groups present", `{"memberships": [{"name": "groups/000000000000000/memberships/123456789101112131415", "memberKey": {"id": "user@example.com"}, "roles": [{"name": "MEMBER"}], "preferredMemberKey": {"id": "user@example.com"}}], "nextPageToken": ""}`, - []string{}, + make([]string, 0), "", }, { "groups present with nextPageToken", `{"memberships": [{"name": "groups/000000000000000/memberships/123456789101112131415", "memberKey": {"id": "user@example.com"}, "roles": [{"name": "MEMBER"}], "preferredMemberKey": {"id": "user@example.com"}}], "nextPageToken": "token"}`, - []string{}, + make([]string, 0), "", }, { diff --git a/internal/openvpn/errors.go b/internal/openvpn/errors.go index 5b64530..ee6228c 100644 --- a/internal/openvpn/errors.go +++ b/internal/openvpn/errors.go @@ -10,7 +10,7 @@ var ( ErrUnknownProtocol = errors.New("unknown protocol") ErrInvalidPassword = errors.New("invalid password") ErrErrorResponse = errors.New("error response") - ErrConnectionTerminated = errors.New("OpenVPN management interface connection terminated") + ErrConnectionTerminated = errors.New("openvpn management interface connection terminated") ErrClientSessionStateInvalidOrExpired = errors.New(ReasonStateExpiredOrInvalid) ) diff --git a/internal/openvpn/main.go b/internal/openvpn/main.go index 56ac56a..fe7b79a 100644 --- a/internal/openvpn/main.go +++ b/internal/openvpn/main.go @@ -85,7 +85,7 @@ func (c *Client) Connect() error { err = context.Cause(c.ctx) if err != nil && !errors.Is(err, context.Canceled) { - return fmt.Errorf("OpenVPN management error: %w", err) + return fmt.Errorf("openvpn management error: %w", err) } return nil diff --git a/internal/openvpn/main_test.go b/internal/openvpn/main_test.go index 8cf1f06..17ea9e4 100644 --- a/internal/openvpn/main_test.go +++ b/internal/openvpn/main_test.go @@ -282,7 +282,7 @@ func TestClientFull(t *testing.T) { }, ">CLIENT:CONNECT1,0,1\r\n>CLIENT:ENV,common_name=bypass\r\n>CLIENT:ENV,END\r\n", "", - errors.New("OpenVPN management error: unknown client reason: CONNECT1"), + errors.New("openvpn management error: unknown client reason: CONNECT1"), }, } diff --git a/internal/storage/storage.go b/internal/storage/storage.go index 3a5d56f..fcb59fc 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -54,7 +54,7 @@ func (s *Storage) collect(ctx context.Context) { } } -func (s *Storage) Set(client string, token string) error { +func (s *Storage) Set(client, token string) error { encryptedBytes, err := crypto.EncryptBytesAES([]byte(token), s.encryptionKey) if err != nil { return fmt.Errorf("decrypt error: %w", err) diff --git a/internal/utils/overlayfs.go b/internal/utils/overlayfs.go index 4767843..3bc04a0 100644 --- a/internal/utils/overlayfs.go +++ b/internal/utils/overlayfs.go @@ -3,19 +3,19 @@ package utils import "io/fs" type OverlayFS struct { - fs fs.FS - over fs.FS + root fs.FS + overlay fs.FS } -func NewOverlayFS(fs, over fs.FS) *OverlayFS { return &OverlayFS{fs, over} } +func NewOverlayFS(root, over fs.FS) *OverlayFS { return &OverlayFS{root, over} } func (f *OverlayFS) Open(name string) (fs.File, error) { - fi, err := fs.Stat(f.over, name) + fi, err := fs.Stat(f.overlay, name) if err == nil && !fi.IsDir() { - if f, err := f.over.Open(name); err == nil { + if f, err := f.overlay.Open(name); err == nil { return f, nil } } - return f.fs.Open(name) //nolint:wrapcheck + return f.root.Open(name) //nolint:wrapcheck } diff --git a/internal/utils/testutils/main.go b/internal/utils/testutils/main.go index e4ee8ba..7591ca2 100644 --- a/internal/utils/testutils/main.go +++ b/internal/utils/testutils/main.go @@ -25,7 +25,7 @@ import ( "github.com/jkroepke/openvpn-auth-oauth2/internal/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - oidcStorage "github.com/zitadel/oidc/v3/example/server/storage" + oidcstorage "github.com/zitadel/oidc/v3/example/server/storage" "github.com/zitadel/oidc/v3/pkg/op" "golang.org/x/net/nettest" "golang.org/x/text/language" @@ -118,7 +118,7 @@ func ExpectMessage(tb testing.TB, conn net.Conn, reader *bufio.Reader, expectMes return true } -func SendAndExpectMessage(tb testing.TB, conn net.Conn, reader *bufio.Reader, sendMessage string, expectMessage string) bool { +func SendAndExpectMessage(tb testing.TB, conn net.Conn, reader *bufio.Reader, sendMessage, expectMessage string) bool { tb.Helper() err := conn.SetWriteDeadline(time.Now().Add(time.Second * 5)) @@ -178,18 +178,18 @@ func ReadLine(tb testing.TB, conn net.Conn, reader *bufio.Reader) string { func SetupResourceServer(tb testing.TB, clientListener net.Listener) (*httptest.Server, *url.URL, config.OAuth2Client, error) { tb.Helper() - client := oidcStorage.WebClient( + client := oidcstorage.WebClient( clientListener.Addr().String(), "SECRET", fmt.Sprintf("http://%s/oauth2/callback", clientListener.Addr().String()), fmt.Sprintf("https://%s/oauth2/callback", clientListener.Addr().String()), ) - clients := map[string]*oidcStorage.Client{ + clients := map[string]*oidcstorage.Client{ client.GetID(): client, } - opStorage := oidcStorage.NewStorageWithClients(oidcStorage.NewUserStore("http://localhost"), clients) + opStorage := oidcstorage.NewStorageWithClients(oidcstorage.NewUserStore("http://localhost"), clients) opConfig := &op.Config{ CryptoKey: sha256.Sum256([]byte("test")), DefaultLogoutRedirectURI: "/", diff --git a/pkg/plugin/go.mod b/pkg/plugin/go.mod index 17b05b6..a05b280 100644 --- a/pkg/plugin/go.mod +++ b/pkg/plugin/go.mod @@ -27,14 +27,14 @@ require ( github.com/zitadel/logging v0.6.1 // indirect github.com/zitadel/oidc/v3 v3.33.1 // indirect github.com/zitadel/schema v1.3.0 // indirect - go.opentelemetry.io/otel v1.32.0 // indirect - go.opentelemetry.io/otel/metric v1.32.0 // indirect - go.opentelemetry.io/otel/trace v1.32.0 // indirect - golang.org/x/crypto v0.30.0 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel v1.33.0 // indirect + go.opentelemetry.io/otel/metric v1.33.0 // indirect + go.opentelemetry.io/otel/trace v1.33.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/plugin/go.sum b/pkg/plugin/go.sum index f31810e..1da4d53 100644 --- a/pkg/plugin/go.sum +++ b/pkg/plugin/go.sum @@ -7,8 +7,8 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= -github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.2.0 h1:Aj1EtB0qR2Rdo2dG4O94RIU35w2lvQSj6BRA4+qwFL0= +github.com/go-chi/chi/v5 v5.2.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E= github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -42,10 +42,8 @@ github.com/knadh/koanf/providers/structs v0.1.0 h1:wJRteCNn1qvLtE5h8KQBvLJovidSd github.com/knadh/koanf/providers/structs v0.1.0/go.mod h1:sw2YZ3txUcqA3Z27gPlmmBzWn1h8Nt9O6EP/91MkcWE= github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/madflojo/testcerts v1.3.0 h1:H6r7WlzfeLqzcuOglfAlnj5Rkt5iQoH1ctTi7FsLOdE= @@ -60,6 +58,8 @@ github.com/muhlemmer/httpforwarded v0.1.0 h1:x4DLrzXdliq8mprgUMR0olDvHGkou5BJsK/ github.com/muhlemmer/httpforwarded v0.1.0/go.mod h1:yo9czKedo2pdZhoXe+yDkGVbU0TJ0q9oQ90BVoDEtw0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -74,16 +74,18 @@ github.com/zitadel/oidc/v3 v3.33.1 h1:e3w9PDV0Mh50/ZiJWtzyT0E4uxJ6RXll+hqVDnqGbT github.com/zitadel/oidc/v3 v3.33.1/go.mod h1:zkoZ1Oq6CweX3BaLrftLEGCs6YK6zDpjjVGZrP10AWU= github.com/zitadel/schema v1.3.0 h1:kQ9W9tvIwZICCKWcMvCEweXET1OcOyGEuFbHs4o5kg0= github.com/zitadel/schema v1.3.0/go.mod h1:NptN6mkBDFvERUCvZHlvWmmME+gmZ44xzwRXwhzsbtc= -go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= -go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= -go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= -go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= -go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= -go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= -golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= -golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= +go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= +go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ= +go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M= +go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= +go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= +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/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/tools/go.mod b/tools/go.mod index 37ef70f..ec94a50 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -18,7 +18,7 @@ require ( github.com/4meepo/tagalign v1.3.4 // indirect github.com/Abirdcfly/dupword v0.1.3 // indirect github.com/Antonboom/errname v1.0.0 // indirect - github.com/Antonboom/nilnil v1.0.0 // indirect + github.com/Antonboom/nilnil v1.0.1 // indirect github.com/Antonboom/testifylint v1.5.2 // indirect github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect github.com/Crocmagnon/fatcontext v0.5.3 // indirect @@ -26,7 +26,7 @@ require ( github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.3.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect - github.com/alecthomas/go-check-sumtype v0.2.0 // indirect + github.com/alecthomas/go-check-sumtype v0.3.1 // indirect github.com/alexkohler/nakedret/v2 v2.0.5 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect @@ -117,7 +117,7 @@ require ( github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.18.3 // indirect + github.com/nunnatsa/ginkgolinter v0.18.4 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -151,7 +151,7 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.7.0 // indirect + github.com/spf13/cast v1.7.1 // indirect github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.19.0 // indirect @@ -165,9 +165,9 @@ require ( github.com/timonwong/loggercheck v0.10.1 // indirect github.com/tomarrell/wrapcheck/v2 v2.10.0 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect - github.com/ultraware/funlen v0.1.0 // indirect - github.com/ultraware/whitespace v0.1.1 // indirect - github.com/uudashr/gocognit v1.1.4 // indirect + github.com/ultraware/funlen v0.2.0 // indirect + github.com/ultraware/whitespace v0.2.0 // indirect + github.com/uudashr/gocognit v1.2.0 // indirect github.com/uudashr/iface v1.3.0 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect @@ -179,13 +179,13 @@ require ( go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d // indirect - golang.org/x/exp/typeparams v0.0.0-20241204233417-43b7b7cde48d // indirect + golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect + golang.org/x/exp/typeparams v0.0.0-20241217172543-b2144cdd0a67 // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect - google.golang.org/protobuf v1.35.2 // indirect + google.golang.org/protobuf v1.36.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/go.sum b/tools/go.sum index 39f85d6..f6203e9 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -8,8 +8,8 @@ github.com/Abirdcfly/dupword v0.1.3 h1:9Pa1NuAsZvpFPi9Pqkd93I7LIYRURj+A//dFd5tgB github.com/Abirdcfly/dupword v0.1.3/go.mod h1:8VbB2t7e10KRNdwTVoxdBaxla6avbhGzb8sCTygUMhw= github.com/Antonboom/errname v1.0.0 h1:oJOOWR07vS1kRusl6YRSlat7HFnb3mSfMl6sDMRoTBA= github.com/Antonboom/errname v1.0.0/go.mod h1:gMOBFzK/vrTiXN9Oh+HFs+e6Ndl0eTFbtsRTSRdXyGI= -github.com/Antonboom/nilnil v1.0.0 h1:n+v+B12dsE5tbAqRODXmEKfZv9j2KcTBrp+LkoM4HZk= -github.com/Antonboom/nilnil v1.0.0/go.mod h1:fDJ1FSFoLN6yoG65ANb1WihItf6qt9PJVTn/s2IrcII= +github.com/Antonboom/nilnil v1.0.1 h1:C3Tkm0KUxgfO4Duk3PM+ztPncTFlOf0b2qadmS0s4xs= +github.com/Antonboom/nilnil v1.0.1/go.mod h1:CH7pW2JsRNFgEh8B2UaPZTEPhCMuFowP/e8Udp9Nnb0= github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5lGoQazk= github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= @@ -24,12 +24,12 @@ github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7r github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= -github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= -github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/go-check-sumtype v0.2.0 h1:Bo+e4DFf3rs7ME9w/0SU/g6nmzJaphduP8Cjiz0gbwY= -github.com/alecthomas/go-check-sumtype v0.2.0/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= -github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= -github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= +github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/go-check-sumtype v0.3.1 h1:u9aUvbGINJxLVXiFvHUlPEaD7VDULsrxJb4Aq31NLkU= +github.com/alecthomas/go-check-sumtype v0.3.1/go.mod h1:A8TSiN3UPRw3laIgWEUOHHLPa6/r9MtoigdlP5h3K/E= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alexkohler/nakedret/v2 v2.0.5 h1:fP5qLgtwbx9EJE8dGEERT02YwS8En4r9nnZ71RK+EVU= github.com/alexkohler/nakedret/v2 v2.0.5/go.mod h1:bF5i0zF2Wo2o4X4USt9ntUWve6JbFv02Ff4vlkmS/VU= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= @@ -259,8 +259,8 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.18.3 h1:WgS7X3zzmni3vwHSBhvSgqrRgUecN6PQUcfB0j1noDw= -github.com/nunnatsa/ginkgolinter v0.18.3/go.mod h1:BE1xyB/PNtXXG1azrvrqJW5eFH0hSRylNzFy8QHPwzs= +github.com/nunnatsa/ginkgolinter v0.18.4 h1:zmX4KUR+6fk/vhUFt8DOP6KwznekhkmVSzzVJve2vyM= +github.com/nunnatsa/ginkgolinter v0.18.4/go.mod h1:AMEane4QQ6JwFz5GgjI5xLUM9S/CylO+UyM97fN2iBI= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= @@ -345,8 +345,8 @@ github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCp github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= -github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= +github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -389,12 +389,12 @@ github.com/tomarrell/wrapcheck/v2 v2.10.0 h1:SzRCryzy4IrAH7bVGG4cK40tNUhmVmMDuJu github.com/tomarrell/wrapcheck/v2 v2.10.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= -github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= -github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= -github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/Gk8VQ= -github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= -github.com/uudashr/gocognit v1.1.4 h1:cQT28wnJPyaH6q1kM0OzgloVNNK5dRRkogAEh3K9Mio= -github.com/uudashr/gocognit v1.1.4/go.mod h1:k/DdKPI6XBZO1q7HgoV2juESI2/Ofj9AcHPZhBBdrTU= +github.com/ultraware/funlen v0.2.0 h1:gCHmCn+d2/1SemTdYMiKLAHFYxTYz7z9VIDRaTGyLkI= +github.com/ultraware/funlen v0.2.0/go.mod h1:ZE0q4TsJ8T1SQcjmkhN/w+MceuatI6pBFSxxyteHIJA= +github.com/ultraware/whitespace v0.2.0 h1:TYowo2m9Nfj1baEQBjuHzvMRbp19i+RCcRYrSWoFa+g= +github.com/ultraware/whitespace v0.2.0/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= +github.com/uudashr/gocognit v1.2.0 h1:3BU9aMr1xbhPlvJLSydKwdLN3tEUUrzPSSM8S4hDYRA= +github.com/uudashr/gocognit v1.2.0/go.mod h1:k/DdKPI6XBZO1q7HgoV2juESI2/Ofj9AcHPZhBBdrTU= github.com/uudashr/iface v1.3.0 h1:zwPch0fs9tdh9BmL5kcgSpvnObV+yHjO4JjVBl8IA10= github.com/uudashr/iface v1.3.0/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= @@ -433,12 +433,12 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d h1:0olWaB5pg3+oychR51GUVCEsGkeCU/2JxjBgIo4f3M0= -golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20241204233417-43b7b7cde48d h1:WQHXGzzI2u+AAlupPRpQbdG4WVvVZ7d2dg/CkpEu1hI= -golang.org/x/exp/typeparams v0.0.0-20241204233417-43b7b7cde48d/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20241217172543-b2144cdd0a67 h1:aOkGQa5iWYZjkoBaUQ8KyQfznXDSSumUfxSlEWSnmIM= +golang.org/x/exp/typeparams v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -557,8 +557,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= -google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ= +google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=