From f4c4d3c989dc14d74fac19022eb96ca0f0a198b2 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 20 Oct 2022 10:29:12 +0200 Subject: [PATCH 01/16] fix geoip allow/disallow command line options --- internal/commands/mt.go | 4 ++-- internal/model/version/version.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/commands/mt.go b/internal/commands/mt.go index 724e998..2f9c290 100644 --- a/internal/commands/mt.go +++ b/internal/commands/mt.go @@ -293,14 +293,14 @@ func getRestrFlags(opts *restrictionOpts) []cli.Flag { Name: "geo-ip-allow", Usage: "Restrict the mytoken so that it can be only used from these COUNTRIES. " + "Must be a short country code, e.g. 'us'.", - Destination: &opts.RestrictIP, + Destination: &opts.RestrictGeoIPAllow, Placeholder: "COUNTRY", }, &cli.StringSliceFlag{ Name: "geo-ip-disallow", Usage: "Restrict the mytoken so that it cannot be used from these COUNTRIES. " + "Must be a short country code, e.g. 'us'.", - Destination: &opts.RestrictIP, + Destination: &opts.RestrictGeoIPDisallow, Placeholder: "COUNTRY", }, &cli.Int64Flag{ diff --git a/internal/model/version/version.go b/internal/model/version/version.go index ea0099f..f288640 100644 --- a/internal/model/version/version.go +++ b/internal/model/version/version.go @@ -8,7 +8,7 @@ import ( const ( MAJOR = 0 MINOR = 5 - FIX = 2 + FIX = 3 DEV = false ) From c85e09417ffdcfcd524819ad30306ee3307ac984 Mon Sep 17 00:00:00 2001 From: zachmann Date: Tue, 15 Nov 2022 08:42:59 +0100 Subject: [PATCH 02/16] update to api (host ip change) --- config/restrictions.d/ip-this | 2 +- go.mod | 4 ++-- go.sum | 13 ++++++------- internal/commands/mt.go | 12 +++++++----- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/config/restrictions.d/ip-this b/config/restrictions.d/ip-this index de0980d..be07f5b 100644 --- a/config/restrictions.d/ip-this +++ b/config/restrictions.d/ip-this @@ -1,5 +1,5 @@ { - "ip": [ + "hosts": [ "this" ] } \ No newline at end of file diff --git a/go.mod b/go.mod index 1d23123..ecdfff0 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/evanphx/json-patch/v5 v5.6.0 github.com/gliderlabs/ssh v0.3.5 github.com/mdp/qrterminal/v3 v3.0.0 - github.com/oidc-mytoken/api v0.8.0 - github.com/oidc-mytoken/lib v0.6.0 + github.com/oidc-mytoken/api v0.9.1 + github.com/oidc-mytoken/lib v0.6.1 github.com/oidc-mytoken/server v0.6.0 github.com/olekukonko/tablewriter v0.0.5 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 3f5da7d..2c50a2a 100644 --- a/go.sum +++ b/go.sum @@ -354,17 +354,16 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/oidc-mytoken/api v0.8.0 h1:V/8LyLcVtYX1xxj+r6KyShDYUhl1giHLPVB6dTZyQtk= -github.com/oidc-mytoken/api v0.8.0/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= -github.com/oidc-mytoken/lib v0.5.0/go.mod h1:r6shfKy8/15vqGJvciCPphRkKffvIegSqj0uA6kzuns= -github.com/oidc-mytoken/lib v0.6.0 h1:hsydbF2QPrL40kWny2mWciW055TpuPPkcTMMqzHl/6s= -github.com/oidc-mytoken/lib v0.6.0/go.mod h1:r6shfKy8/15vqGJvciCPphRkKffvIegSqj0uA6kzuns= -github.com/oidc-mytoken/server v0.6.0 h1:c3OEJZpshK8sMdrCIHSqLrf6TU7cHIir6I/kHqdovqA= -github.com/oidc-mytoken/server v0.6.0/go.mod h1:UuhznDeB+pgB+b/fNVwn95ui+3tCW0eg2pJOA2lhYyI= +github.com/oidc-mytoken/api v0.9.0/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= +github.com/oidc-mytoken/api v0.9.1 h1:Hmv+KaGyxiodf92mXjELFeZOa9tBsQnUyEoBAFQNls8= +github.com/oidc-mytoken/api v0.9.1/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= +github.com/oidc-mytoken/lib v0.6.1 h1:ZtPj/1dc8rOf7VJlyCp3uBWEcEZJ7L2Ab50oI/ruoa4= +github.com/oidc-mytoken/lib v0.6.1/go.mod h1:AuKCljwZSdYfia6G6FvHl926pR/8ICyxrkbYKQgoGd4= 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/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pires/go-proxyproto v0.6.2/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/internal/commands/mt.go b/internal/commands/mt.go index 2f9c290..00f97f4 100644 --- a/internal/commands/mt.go +++ b/internal/commands/mt.go @@ -155,7 +155,7 @@ func (opts *mtOpts) parseRestrictionOpts(ctx *cli.Context) (err error) { ExpiresAt: exp, Scope: strings.Join(opts.RestrictScopes.Value(), " "), Audiences: opts.RestrictAudiences.Value(), - IPs: opts.RestrictIP.Value(), + Hosts: opts.RestrictIP.Value(), GeoIPAllow: opts.RestrictGeoIPAllow.Value(), GeoIPDisallow: opts.RestrictGeoIPDisallow.Value(), } @@ -166,7 +166,7 @@ func (opts *mtOpts) parseRestrictionOpts(ctx *cli.Context) (err error) { rr.UsagesOther = utils.NewInt64(opts.RestrictUsagesOther) } if rr.UsagesAT != nil || rr.UsagesOther != nil || rr.NotBefore != 0 || rr.ExpiresAt != 0 || rr.Scope != "" || - len(rr.Audiences) != 0 || len(rr.IPs) != 0 || len(rr.GeoIPAllow) != 0 || len(rr.GeoIPAllow) != 0 { + len(rr.Audiences) != 0 || len(rr.Hosts) != 0 || len(rr.GeoIPAllow) != 0 || len(rr.GeoIPAllow) != 0 { opts.request.Restrictions = api.Restrictions{rr} } return @@ -279,13 +279,15 @@ func getRestrFlags(opts *restrictionOpts) []cli.Flag { Destination: &opts.RestrictNbf, }, &cli.StringSliceFlag{ - Name: "ip", + Name: "host", Aliases: []string{ + "ip", "ips", "ip-allow", + "hosts", }, - Usage: "Restrict the mytoken so that it can only be used from these IPs. " + - "Can be a network address block or a single ip.", + Usage: "Restrict the mytoken so that it can only be used from these hosts. " + + "Can be a network address block, a single ip, or a host name.", Destination: &opts.RestrictIP, Placeholder: "IP", }, From 7a9b29955640bd94c6a84e0840b320c6d056bd44 Mon Sep 17 00:00:00 2001 From: zachmann Date: Tue, 15 Nov 2022 09:19:53 +0100 Subject: [PATCH 03/16] refactor utils --- cmd/mytoken/main.go | 6 +- go.mod | 5 +- go.sum | 267 +----- internal/commands/general.go | 11 +- internal/commands/info.go | 4 +- internal/commands/mt.go | 9 +- internal/commands/sshGrant.go | 4 +- internal/config/config.go | 6 +- internal/utils/duration/duration.go | 155 ---- internal/utils/jsonutils/json.go | 55 -- internal/utils/jsonutils/json_test.go | 156 ---- internal/utils/profile/capabilities.go | 60 -- internal/utils/profile/profile.go | 70 -- internal/utils/profile/restrictions.go | 51 -- internal/utils/profile/rotation.go | 34 - internal/utils/profile/template.go | 172 ---- internal/utils/profile/template_test.go | 1005 ----------------------- internal/utils/timerestriction.go | 58 -- 18 files changed, 36 insertions(+), 2092 deletions(-) delete mode 100644 internal/utils/duration/duration.go delete mode 100644 internal/utils/jsonutils/json.go delete mode 100644 internal/utils/jsonutils/json_test.go delete mode 100644 internal/utils/profile/capabilities.go delete mode 100644 internal/utils/profile/profile.go delete mode 100644 internal/utils/profile/restrictions.go delete mode 100644 internal/utils/profile/rotation.go delete mode 100644 internal/utils/profile/template.go delete mode 100644 internal/utils/profile/template_test.go delete mode 100644 internal/utils/timerestriction.go diff --git a/cmd/mytoken/main.go b/cmd/mytoken/main.go index b7aed3f..e96e6ff 100644 --- a/cmd/mytoken/main.go +++ b/cmd/mytoken/main.go @@ -4,7 +4,7 @@ import ( "fmt" mytokenlib "github.com/oidc-mytoken/lib" - "github.com/oidc-mytoken/server/shared/httpClient" + "github.com/oidc-mytoken/utils/httpclient" "golang.org/x/net/context" "github.com/oidc-mytoken/client/internal/commands" @@ -20,8 +20,8 @@ func init() { func main() { logger.Init() - httpClient.Init("", "") // This useragent is not used by lib, so not needed - mytokenlib.SetClient(httpClient.Do().GetClient()) + httpclient.Init("", "") // This useragent is not used by lib, so not needed + mytokenlib.SetClient(httpclient.Do().GetClient()) mytokenlib.SetContext(ctx) commands.Parse() } diff --git a/go.mod b/go.mod index ecdfff0..5d979f5 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,16 @@ go 1.16 require ( github.com/Songmu/prompter v0.5.1 - github.com/evanphx/json-patch/v5 v5.6.0 github.com/gliderlabs/ssh v0.3.5 github.com/mdp/qrterminal/v3 v3.0.0 github.com/oidc-mytoken/api v0.9.1 github.com/oidc-mytoken/lib v0.6.1 - github.com/oidc-mytoken/server v0.6.0 + github.com/oidc-mytoken/utils v0.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.0 github.com/urfave/cli/v2 v2.3.1-0.20211205195634-e8d81738896c - golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b + golang.org/x/net v0.0.0-20220906165146-f3363e06e74c golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 2c50a2a..d7c383b 100644 --- a/go.sum +++ b/go.sum @@ -25,7 +25,6 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= @@ -43,7 +42,6 @@ cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLq cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= @@ -58,44 +56,20 @@ cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= -github.com/CloudyKit/jet/v6 v6.1.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= -github.com/Joker/jade v1.1.3/go.mod h1:T+2WLyt7VH6Lp0TRxQrUYEs64nRc83wkMQrfeIQKduM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Songmu/prompter v0.5.1 h1:IAsttKsOZWSDw7bV1mtGn9TAmLFAjXbp9I/eYmUUogo= github.com/Songmu/prompter v0.5.1/go.mod h1:CS3jEPD6h9IaLaG6afrl1orTgII9+uDWuw95dr6xHSw= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/cbroglie/mustache v1.4.0/go.mod h1:SS1FTIghy0sjse4DUVGV1k/40B1qE1XkD9DtDsHo9iM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -106,21 +80,13 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-oidc/v3 v3.4.0 h1:xz7elHb/LDwm/ERpwHd+5nb7wFHL32rsr6bBOgaeu6g= github.com/coreos/go-oidc/v3 v3.4.0/go.mod h1:eHUXhZtXPQLgEaDrOVTgwbgmz1xGOkJNye6h3zkD2Pw= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -129,48 +95,24 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofiber/fiber/v2 v2.37.0/go.mod h1:xm3pDGlfE1xqVKb77iH8weLU0FFoTeWeK3nbiYM2Nh0= -github.com/gofiber/fiber/v2 v2.37.1/go.mod h1:j3UslgQeJQP3mNhBxHnLLE8TPqA1Fd/lrl4gD25rRUY= -github.com/gofiber/helmet/v2 v2.2.16/go.mod h1:rJ/S3yuSzSQAQROSoHE4uqsB1oLUREDnRJScaoByHtM= -github.com/gofiber/template v1.7.1/go.mod h1:l3ZOSp8yrMvROzqyh0QTCw7MHet/yLBzaRX+wsiw+gM= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 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/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -216,7 +158,6 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -247,173 +188,59 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/ip2location/ip2location-go v8.3.0+incompatible/go.mod h1:3JUY1TBjTx1GdA7oRT7Zeqfc0bg3lMMuU5lXmzdpuME= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= -github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.15.0 h1:xqfchp4whNFxn5A4XFyyYtitiWI8Hy5EW59jEwcyL6U= -github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= -github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ= -github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= -github.com/lestrrat-go/jwx v1.2.25/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY= -github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-slim v0.0.0-20200618151855-bde33eecb5ee/go.mod h1:ma9TUJeni8LGZMJvOwbAv/FOwiwqIMQN570LnpqCBSM= -github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oidc-mytoken/api v0.9.0/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= github.com/oidc-mytoken/api v0.9.1 h1:Hmv+KaGyxiodf92mXjELFeZOa9tBsQnUyEoBAFQNls8= github.com/oidc-mytoken/api v0.9.1/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= github.com/oidc-mytoken/lib v0.6.1 h1:ZtPj/1dc8rOf7VJlyCp3uBWEcEZJ7L2Ab50oI/ruoa4= github.com/oidc-mytoken/lib v0.6.1/go.mod h1:AuKCljwZSdYfia6G6FvHl926pR/8ICyxrkbYKQgoGd4= +github.com/oidc-mytoken/utils v0.1.0 h1:Ia60CYjVzs4X35twdAB1NTXDyYjxe/IWDI/MkcvQHnc= +github.com/oidc-mytoken/utils v0.1.0/go.mod h1:pAUlvF/mYz8CjinCx4iwoWzG514B9EhuCpu7O+afaD8= 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/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pires/go-proxyproto v0.6.2/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= 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/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -421,26 +248,18 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.39.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= -github.com/valyala/fasthttp v1.40.0 h1:CRq/00MfruPGFLTQKY8b+8SfdK60TxNztjRMnH0t1Yc= -github.com/valyala/fasthttp v1.40.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= +github.com/valyala/fasthttp v1.41.0 h1:zeR0Z1my1wDHTRiamBCXVglQdbUwgb9uWG3k1HQz6jY= +github.com/valyala/fasthttp v1.41.0/go.mod h1:f6VbjjoI3z1NDOZOv17o6RvtRSWxC77seBFc2uWtgiY= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= -github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zachmann/cli/v2 v2.3.1-0.20211220102037-d619fd40a704 h1:dpR/K16zQgc/5xTQ66RevZikjkFzsCt6IeNDFyHltaM= github.com/zachmann/cli/v2 v2.3.1-0.20211220102037-d619fd40a704/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -449,21 +268,12 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= 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.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d h1:3qF+Z8Hkrw9sOhrFHti9TlB1Hkac1x+DNRkv0XQiFjo= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -501,25 +311,18 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -542,10 +345,7 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -555,8 +355,9 @@ golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b h1:ZmngSVLe/wycRns9MKikG9OWIEjGcGAkacif7oYQaUY= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20220906165146-f3363e06e74c h1:yKufUcDwucU5urd+50/Opbt4AYpqthk7wHpHok8f1lo= +golang.org/x/net v0.0.0-20220906165146-f3363e06e74c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -572,7 +373,6 @@ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= @@ -592,32 +392,21 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -636,12 +425,10 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -650,14 +437,9 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -703,7 +485,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -728,7 +509,6 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -737,14 +517,12 @@ golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= 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= @@ -781,9 +559,7 @@ google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6 google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= @@ -858,11 +634,7 @@ google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= @@ -909,7 +681,6 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= @@ -931,25 +702,15 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/commands/general.go b/internal/commands/general.go index 3ad5190..81fc8ed 100644 --- a/internal/commands/general.go +++ b/internal/commands/general.go @@ -7,10 +7,9 @@ import ( "github.com/Songmu/prompter" mytokenlib "github.com/oidc-mytoken/lib" - "github.com/oidc-mytoken/server/shared/utils" - "github.com/oidc-mytoken/server/shared/utils/issuerUtils" - "github.com/oidc-mytoken/server/shared/utils/jwtutils" - "github.com/oidc-mytoken/server/shared/utils/ternary" + "github.com/oidc-mytoken/utils/utils/issuerutils" + "github.com/oidc-mytoken/utils/utils/jwtutils" + "github.com/oidc-mytoken/utils/utils/ternary" log "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" @@ -145,14 +144,14 @@ func appendMTFlags(flags ...cli.Flag) []cli.Flag { } func updateMytokenServerFromJWT(token string) { - if !utils.IsJWT(token) { + if !jwtutils.IsJWT(token) { return } iss, ok := jwtutils.GetStringFromJWT(log.StandardLogger(), token, "iss") if !ok { return } - if issuerUtils.CompareIssuerURLs(config.Get().URL, iss) { + if issuerutils.CompareIssuerURLs(config.Get().URL, iss) { return } config.Get().URL = iss diff --git a/internal/commands/info.go b/internal/commands/info.go index 3ffce6f..af6b3f4 100644 --- a/internal/commands/info.go +++ b/internal/commands/info.go @@ -9,7 +9,7 @@ import ( "time" "github.com/oidc-mytoken/api/v0" - "github.com/oidc-mytoken/server/shared/utils" + "github.com/oidc-mytoken/utils/utils/jwtutils" "github.com/urfave/cli/v2" "github.com/oidc-mytoken/client/internal/config" @@ -92,7 +92,7 @@ func prettyPrintJSON(obj interface{}) error { func info(_ *cli.Context) error { mToken := infoOptions.MustGetToken() - if !utils.IsJWT(mToken) { + if !jwtutils.IsJWT(mToken) { return fmt.Errorf("The token is not a JWT.") } payload := strings.Split(mToken, ".")[1] diff --git a/internal/commands/mt.go b/internal/commands/mt.go index 00f97f4..9c7911a 100644 --- a/internal/commands/mt.go +++ b/internal/commands/mt.go @@ -7,12 +7,13 @@ import ( "github.com/oidc-mytoken/api/v0" mytokenlib "github.com/oidc-mytoken/lib" - "github.com/oidc-mytoken/server/shared/utils" + "github.com/oidc-mytoken/utils/utils" + "github.com/oidc-mytoken/utils/utils/profile" + "github.com/oidc-mytoken/utils/utils/timerestriction" "github.com/urfave/cli/v2" "github.com/oidc-mytoken/client/internal/config" cutils "github.com/oidc-mytoken/client/internal/utils" - "github.com/oidc-mytoken/client/internal/utils/profile" "github.com/oidc-mytoken/client/internal/utils/qr" ) @@ -142,11 +143,11 @@ func (opts *mtOpts) parseRestrictionOpts(ctx *cli.Context) (err error) { } return } - nbf, err := cutils.ParseTime(opts.RestrictNbf) + nbf, err := timerestriction.ParseTime(opts.RestrictNbf) if err != nil { return } - exp, err := cutils.ParseTime(opts.RestrictExp) + exp, err := timerestriction.ParseTime(opts.RestrictExp) if err != nil { return } diff --git a/internal/commands/sshGrant.go b/internal/commands/sshGrant.go index 8072cd3..f4eceb4 100644 --- a/internal/commands/sshGrant.go +++ b/internal/commands/sshGrant.go @@ -9,12 +9,12 @@ import ( "github.com/gliderlabs/ssh" "github.com/oidc-mytoken/api/v0" mytokenlib "github.com/oidc-mytoken/lib" - "github.com/oidc-mytoken/server/shared/utils/fileutil" + "github.com/oidc-mytoken/utils/utils/fileutil" + "github.com/oidc-mytoken/utils/utils/profile" "github.com/pkg/errors" "github.com/urfave/cli/v2" "github.com/oidc-mytoken/client/internal/config" - "github.com/oidc-mytoken/client/internal/utils/profile" "github.com/oidc-mytoken/client/internal/utils/tablewriter" ) diff --git a/internal/config/config.go b/internal/config/config.go index 1119a8f..4124916 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,8 +7,8 @@ import ( "github.com/oidc-mytoken/api/v0" mytokenlib "github.com/oidc-mytoken/lib" - "github.com/oidc-mytoken/server/shared/httpClient" - "github.com/oidc-mytoken/server/shared/utils/fileutil" + "github.com/oidc-mytoken/utils/httpclient" + "github.com/oidc-mytoken/utils/utils/fileutil" log "github.com/sirupsen/logrus" "gopkg.in/yaml.v3" ) @@ -54,7 +54,7 @@ func load(name string, locations []string) { log.Fatal(err) } conf.usedConfigDir = usedLocation - mytokenlib.SetClient(httpClient.Do().GetClient()) + mytokenlib.SetClient(httpclient.Do().GetClient()) mytoken, err := mytokenlib.NewMytokenServer(conf.URL) if err != nil { log.Fatal(err) diff --git a/internal/utils/duration/duration.go b/internal/utils/duration/duration.go deleted file mode 100644 index 0b52bb6..0000000 --- a/internal/utils/duration/duration.go +++ /dev/null @@ -1,155 +0,0 @@ -package duration - -import ( - "time" - - "github.com/pkg/errors" -) - -var unitMap = map[string]int64{ - "ns": int64(time.Nanosecond), - "us": int64(time.Microsecond), - "µs": int64(time.Microsecond), // U+00B5 = micro symbol - "μs": int64(time.Microsecond), // U+03BC = Greek letter mu - "ms": int64(time.Millisecond), - "s": int64(time.Second), - "m": int64(time.Minute), - "h": int64(time.Hour), - "d": int64(24 * time.Hour), // Approximation - "w": int64(7 * 24 * time.Hour), // Approximation - "y": int64(365 * 24 * time.Hour), // Approximation -} - -const invalidDurErr = "time: invalid duration " - -var errLeadingInt = errors.New("duration: bad [0-9]*") // never printed - -// leadingInt consumes the leading [0-9]* from s. -func leadingInt(s string) (x int64, rem string, err error) { - i := 0 - for ; i < len(s); i++ { - c := s[i] - if c < '0' || c > '9' { - break - } - if x > (1<<63-1)/10 { - // overflow - return 0, "", errLeadingInt - } - x = x*10 + int64(c) - '0' - if x < 0 { - // overflow - return 0, "", errLeadingInt - } - } - return x, s[i:], nil -} - -// ParseDuration parses a duration string. -// A duration string is a possibly signed sequence of -// decimal numbers, each with optional fraction and a unit suffix, -// such as "300ms", "-1.5h" or "2h45m". -// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "y". -func ParseDuration(s string) (time.Duration, error) { - // [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+ - orig := s - var d int64 - neg := false - - // Consume [-+]? - if s != "" { - c := s[0] - if c == '-' || c == '+' { - neg = c == '-' - s = s[1:] - } - } - // Special case: if all that is left is "0", this is zero. - if s == "0" { - return 0, nil - } - if s == "" { - return 0, errors.New(invalidDurErr + orig) - } - for s != "" { - var ( - v, f int64 // integers before, after decimal point - scale float64 = 1 // value = v + f/scale - ) - - var err error - - // The next character must be [0-9.] - if !(s[0] == '.' || '0' <= s[0] && s[0] <= '9') { - return 0, errors.New(invalidDurErr + orig) - } - // Consume [0-9]* - pl := len(s) - v, s, err = leadingInt(s) - if err != nil { - return 0, errors.New(invalidDurErr + orig) - } - pre := pl != len(s) // whether we consumed anything before a period - - // Consume (\.[0-9]*)? - post := false - if s != "" && s[0] == '.' { - s = s[1:] - pl := len(s) - f, s, err = leadingInt(s) - if err != nil { - return 0, errors.New(invalidDurErr + orig) - } - for n := pl - len(s); n > 0; n-- { - scale *= 10 - } - post = pl != len(s) - } - if !pre && !post { - // no digits (e.g. ".s" or "-.s") - return 0, errors.New(invalidDurErr + orig) - } - - // Consume unit. - i := 0 - for ; i < len(s); i++ { - c := s[i] - if c == '.' || '0' <= c && c <= '9' { - break - } - } - if i == 0 { - return 0, errors.New("time: missing unit in duration " + orig) - } - u := s[:i] - s = s[i:] - unit, ok := unitMap[u] - if !ok { - return 0, errors.New("time: unknown unit " + u + " in duration " + orig) - } - if v > (1<<63-1)/unit { - // overflow - return 0, errors.New(invalidDurErr + orig) - } - v *= unit - if f > 0 { - // float64 is needed to be nanosecond accurate for fractions of hours. - // v >= 0 && (f*unit/scale) <= 3.6e+12 (ns/h, h is the largest unit) - v += int64(float64(f) * (float64(unit) / scale)) - if v < 0 { - // overflow - return 0, errors.New(invalidDurErr + orig) - } - } - d += v - if d < 0 { - // overflow - return 0, errors.New(invalidDurErr + orig) - } - } - - if neg { - d = -d - } - return time.Duration(d), nil -} diff --git a/internal/utils/jsonutils/json.go b/internal/utils/jsonutils/json.go deleted file mode 100644 index ee33d90..0000000 --- a/internal/utils/jsonutils/json.go +++ /dev/null @@ -1,55 +0,0 @@ -package jsonutils - -import ( - "bytes" - "encoding/json" -) - -// IsJSONObject checks if the passed data is a JSON Object -func IsJSONObject(data []byte) bool { - var d = struct{}{} - return json.Unmarshal(data, &d) == nil -} - -// IsJSONArray checks if the passed data is a JSON Array -func IsJSONArray(data []byte) bool { - d := make([]interface{}, 0) - return json.Unmarshal(data, &d) == nil -} - -var emptyArray = []byte{ - '[', - ']', -} - -// MergeJSONArrays merges two json arrays into one -func MergeJSONArrays(a1, a2 []byte) []byte { - if bytes.Equal(bytes.Trim(a1, " "), emptyArray) { - return a2 - } - if bytes.Equal(bytes.Trim(a2, " "), emptyArray) { - return a1 - } - res := append(a1[:bytes.LastIndexByte(a1, ']')], ',') // skipcq: CRT-D0001 - res = append(res, a2[bytes.IndexByte(a2, '[')+1:]...) - return res -} - -// Arrayify creates an JSON array with the passed object in -func Arrayify(o []byte) []byte { - return bytes.Join( - [][]byte{ - {'['}, - o, - {']'}, - }, nil, - ) -} - -// UnwrapString removes the " around a string if they exist -func UnwrapString(s []byte) []byte { - if len(s) >= 2 && s[0] == '"' && s[len(s)-1] == '"' { - return s[1 : len(s)-1] - } - return s -} diff --git a/internal/utils/jsonutils/json_test.go b/internal/utils/jsonutils/json_test.go deleted file mode 100644 index 64eaff6..0000000 --- a/internal/utils/jsonutils/json_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package jsonutils - -import ( - "bytes" - "testing" -) - -func Test_IsJSONObject(t *testing.T) { - tests := []struct { - name string - data []byte - result bool - }{ - { - name: "nil", - data: nil, - result: false, - }, - { - name: "empty", - data: []byte{}, - result: false, - }, - { - name: "empty object", - data: []byte("{}"), - result: true, - }, - { - name: "string", - data: []byte("string"), - result: false, - }, - { - name: "object", - data: []byte(`{"key":"value"}`), - result: true, - }, - { - name: "no valid object", - data: []byte(`{something within braces}`), - result: false, - }, - } - for _, test := range tests { - t.Run( - test.name, func(t *testing.T) { - if test.result != IsJSONObject(test.data) { - t.Errorf("IsJSONObject('%s') != %v", test.data, test.result) - } - }, - ) - } -} - -func Test_IsJSONArray(t *testing.T) { - tests := []struct { - name string - data []byte - result bool - }{ - { - name: "nil", - data: nil, - result: false, - }, - { - name: "empty", - data: []byte{}, - result: false, - }, - { - name: "empty array", - data: []byte("[]"), - result: true, - }, - { - name: "string", - data: []byte("string"), - result: false, - }, - { - name: "array with strings", - data: []byte(`["key","other"]`), - result: true, - }, - { - name: "array with objects", - data: []byte(`[{"key":"value"},{"key":"other"}]`), - result: true, - }, - { - name: "mixed", - data: []byte(`["string", {"object": true}]`), - result: true, - }, - { - name: "no valid array", - data: []byte(`[something within braces]`), - result: false, - }, - } - for _, test := range tests { - t.Run( - test.name, func(t *testing.T) { - if test.result != IsJSONArray(test.data) { - t.Errorf("IsJSONArray('%s') != %v", test.data, test.result) - } - }, - ) - } -} - -func Test_MergeJSONArrays(t *testing.T) { - tests := []struct { - name string - a1 []byte - a2 []byte - expected []byte - }{ - { - name: "empty", - a1: []byte(`[]`), - a2: []byte(`[]`), - expected: []byte(`[]`), - }, - { - name: "first empty", - a1: []byte(`[]`), - a2: []byte(`["a","b"]`), - expected: []byte(`["a","b"]`), - }, - { - name: "second empty", - a1: []byte(`["a","b"]`), - a2: []byte(`[]`), - expected: []byte(`["a","b"]`), - }, - { - name: "normal", - a1: []byte(`["a","b"]`), - a2: []byte(`["c"]`), - expected: []byte(`["a","b","c"]`), - }, - } - for _, test := range tests { - t.Run( - test.name, func(t *testing.T) { - res := MergeJSONArrays(test.a1, test.a2) - if !bytes.Equal(test.expected, res) { - t.Errorf("MergeJSONArrays() = %v, want %v", res, test.expected) - } - }, - ) - } -} diff --git a/internal/utils/profile/capabilities.go b/internal/utils/profile/capabilities.go deleted file mode 100644 index 5e62f34..0000000 --- a/internal/utils/profile/capabilities.go +++ /dev/null @@ -1,60 +0,0 @@ -package profile - -import ( - "encoding/json" - "strings" - - "github.com/oidc-mytoken/api/v0" - "github.com/oidc-mytoken/server/shared/utils" - "github.com/pkg/errors" - - "github.com/oidc-mytoken/client/internal/utils/jsonutils" -) - -// ParseCapabilityTemplate parses the content of a capability template -func ParseCapabilityTemplate(content []byte) (api.Capabilities, error) { - capStrings, err := _parseCapabilityTemplate(content) - capStrings = utils.UniqueSlice(capStrings) - var caps api.Capabilities = nil - if err == nil { - caps = api.NewCapabilities(capStrings) - } - return caps, err -} - -func _parseCapabilityTemplateByName(name string) ([]string, error) { - content, err := templateReader.readCapabilityTemplate(normalizeTemplateName(name)) - if err != nil { - return nil, err - } - return _parseCapabilityTemplate(content) -} - -func _parseCapabilityTemplate(content []byte) (capStrings []string, err error) { - if len(content) == 0 { - return nil, nil - } - var tmpCapStrings []string - if jsonutils.IsJSONArray(content) { - if err = errors.WithStack(json.Unmarshal(content, &tmpCapStrings)); err != nil { - return - } - } else { - tmpCapStrings = strings.Split(string(content), " ") - } - for _, c := range tmpCapStrings { - if !strings.HasPrefix(c, "@") { - capStrings = append(capStrings, c) - } else { - templateCaps, e := _parseCapabilityTemplateByName(c[1:]) - if e != nil { - err = e - return - } - if len(templateCaps) > 0 { - capStrings = append(capStrings, templateCaps...) - } - } - } - return -} diff --git a/internal/utils/profile/profile.go b/internal/utils/profile/profile.go deleted file mode 100644 index 82ed3d0..0000000 --- a/internal/utils/profile/profile.go +++ /dev/null @@ -1,70 +0,0 @@ -package profile - -import ( - "encoding/json" - - "github.com/oidc-mytoken/api/v0" - "github.com/pkg/errors" -) - -type profileUnmarshal struct { - api.GeneralMytokenRequest - Restrictions jsonraw `json:"restrictions"` - Capabilities jsonraw `json:"capabilities"` - SubtokenCapabilities jsonraw `json:"subtoken_capabilities"` - Rotation jsonraw `json:"rotation"` -} - -type jsonraw string - -func (r *jsonraw) UnmarshalJSON(data []byte) error { - var raw json.RawMessage - if err := errors.WithStack(json.Unmarshal(data, &raw)); err != nil { - return err - } - rawStr := string(raw) - if rawStr != "" && rawStr[0] == '"' && rawStr[len(rawStr)-1] == '"' { - rawStr = rawStr[1 : len(rawStr)-1] - } - *r = jsonraw(rawStr) - return nil -} - -func parseProfileByName(name string) (api.GeneralMytokenRequest, error) { - content, err := templateReader.readProfile(normalizeTemplateName(name)) - if err != nil { - return api.GeneralMytokenRequest{}, err - } - return ParseProfile(content) -} - -// ParseProfile parses the content of a profile -func ParseProfile(content []byte) (api.GeneralMytokenRequest, error) { - if len(content) == 0 { - return api.GeneralMytokenRequest{}, nil - } - var err error - var p profileUnmarshal - content, err = createFinalTemplate(content, templateReader.readProfile) - if err != nil { - return p.GeneralMytokenRequest, err - } - if len(content) > 0 { - if err = errors.WithStack(json.Unmarshal(content, &p)); err != nil { - return p.GeneralMytokenRequest, err - } - } - p.GeneralMytokenRequest.Rotation, err = ParseRotationTemplate([]byte(p.Rotation)) - if err != nil { - return p.GeneralMytokenRequest, err - } - p.GeneralMytokenRequest.Capabilities, err = ParseCapabilityTemplate([]byte(p.Capabilities)) - if err != nil { - return p.GeneralMytokenRequest, err - } - p.GeneralMytokenRequest.Restrictions, err = ParseRestrictionsTemplate([]byte(p.Restrictions)) - if err != nil { - return p.GeneralMytokenRequest, err - } - return p.GeneralMytokenRequest, nil -} diff --git a/internal/utils/profile/restrictions.go b/internal/utils/profile/restrictions.go deleted file mode 100644 index 1e39634..0000000 --- a/internal/utils/profile/restrictions.go +++ /dev/null @@ -1,51 +0,0 @@ -package profile - -import ( - "encoding/json" - "reflect" - - "github.com/oidc-mytoken/api/v0" - "github.com/pkg/errors" - - "github.com/oidc-mytoken/client/internal/utils" - "github.com/oidc-mytoken/client/internal/utils/jsonutils" -) - -func parseRestrictionsTemplateByName(name string) (api.Restrictions, error) { - content, err := templateReader.readRestrictionsTemplate(normalizeTemplateName(name)) - if err != nil { - return nil, err - } - return ParseRestrictionsTemplate(content) -} - -// ParseRestrictionsTemplate parses the content of a restrictions template -func ParseRestrictionsTemplate(content []byte) (api.Restrictions, error) { - if len(content) == 0 { - return nil, nil - } - - var err error - var restr []utils.APIRestriction - content, err = createFinalTemplate(content, templateReader.readRestrictionsTemplate) - if err != nil { - return nil, err - } - if len(content) == 0 { - return nil, nil - } - if jsonutils.IsJSONObject(content) { - content = jsonutils.Arrayify(content) - } - if err = errors.WithStack(json.Unmarshal(content, &restr)); err != nil { - return nil, err - } - finalRestrs := make(api.Restrictions, 0) - for _, r := range restr { - if !reflect.DeepEqual(r, utils.APIRestriction{}) { - ar := api.Restriction(r) - finalRestrs = append(finalRestrs, &ar) - } - } - return finalRestrs, nil -} diff --git a/internal/utils/profile/rotation.go b/internal/utils/profile/rotation.go deleted file mode 100644 index 4b642a6..0000000 --- a/internal/utils/profile/rotation.go +++ /dev/null @@ -1,34 +0,0 @@ -package profile - -import ( - "encoding/json" - - "github.com/oidc-mytoken/api/v0" - "github.com/pkg/errors" -) - -func parseRotationTemplateByName(name string) (*api.Rotation, error) { - content, err := templateReader.readRotationTemplate(normalizeTemplateName(name)) - if err != nil { - return nil, err - } - return ParseRotationTemplate(content) -} - -// ParseRotationTemplate parses the content of a rotation template -func ParseRotationTemplate(content []byte) (*api.Rotation, error) { - if len(content) == 0 { - return nil, nil - } - var err error - var rot api.Rotation - content, err = createFinalTemplate(content, templateReader.readRotationTemplate) - if err != nil { - return nil, err - } - if len(content) == 0 { - return nil, nil - } - err = errors.WithStack(json.Unmarshal(content, &rot)) - return &rot, err -} diff --git a/internal/utils/profile/template.go b/internal/utils/profile/template.go deleted file mode 100644 index abc9fba..0000000 --- a/internal/utils/profile/template.go +++ /dev/null @@ -1,172 +0,0 @@ -package profile - -import ( - "encoding/json" - "path" - "strings" - - jsonpatch "github.com/evanphx/json-patch/v5" - "github.com/oidc-mytoken/server/shared/utils/fileutil" - "github.com/pkg/errors" - - "github.com/oidc-mytoken/client/internal/utils/jsonutils" -) - -type readFnc func(string) ([]byte, error) - -type TemplateReader struct { - globalBaseDir string - userBaseDir string - reader readFnc -} - -func init() { - templateReader = newTemplateReader(fileutil.ReadFile) -} - -var templateReader *TemplateReader - -func newTemplateReader(reader readFnc) *TemplateReader { - return &TemplateReader{ - globalBaseDir: "/etc/mytoken", - userBaseDir: userBasePath(), - reader: reader, - } -} - -func userBasePath() string { - const conf = "~/.config/mytoken" - const dot = "~/.mytoken" - if fileutil.FileExists(conf) { - return conf - } - return dot -} - -func (r TemplateReader) ReadFile(relPath string) ([]byte, error) { - globalP := path.Join(r.globalBaseDir, relPath) - userP := path.Join(r.userBaseDir, relPath) - global, _ := r.reader(globalP) - user, _ := r.reader(userP) - if len(user) == 0 { - return global, nil - } - if len(global) == 0 { - return user, nil - } - combined, _ := jsonpatch.MergePatch(global, user) - return combined, nil -} - -func (r TemplateReader) readRestrictionsTemplate(name string) ([]byte, error) { - p := path.Join("restrictions.d", name) - return r.ReadFile(p) -} -func (r TemplateReader) readCapabilityTemplate(name string) ([]byte, error) { - p := path.Join("capabilities.d", name) - return r.ReadFile(p) -} -func (r TemplateReader) readRotationTemplate(name string) ([]byte, error) { - p := path.Join("rotation.d", name) - return r.ReadFile(p) -} -func (r TemplateReader) readProfile(name string) ([]byte, error) { - p := path.Join("profiles.d", name) - return r.ReadFile(p) -} - -func normalizeTemplateName(name string) string { - if name != "" && name[0] == '@' { - return name[1:] - } - return name -} - -type includeTemplates struct { - Include json.RawMessage `json:"include"` -} - -func createFinalTemplate(content []byte, read readFnc) ([]byte, error) { - if len(content) == 0 { - return nil, nil - } - baseIsArray := jsonutils.IsJSONArray(content) - if baseIsArray { - var contents []json.RawMessage - if err := errors.WithStack(json.Unmarshal(content, &contents)); err != nil { - return nil, err - } - final := []byte(`[]`) - for _, c := range contents { - c = jsonutils.UnwrapString(c) - cf, err := createFinalTemplate(c, read) - if err != nil { - return nil, err - } - if !jsonutils.IsJSONArray(cf) { - cf = jsonutils.Arrayify(cf) - } - final = jsonutils.MergeJSONArrays(final, cf) - } - return final, nil - } - - if !jsonutils.IsJSONObject(content) { - // must be one or multiple template names - templates := strings.Split(string(content), " ") - if len(templates) == 1 { - // must be single template name - c, err := read(normalizeTemplateName(templates[0])) - if err != nil { - return nil, err - } - return createFinalTemplate(c, read) - } - // multiple templates - return parseIncludes([]byte(`{}`), templates, read) - } - var inc includeTemplates - if err := errors.WithStack(json.Unmarshal(content, &inc)); err != nil { - return nil, err - } - includes := make([]string, 0) - if len(inc.Include) > 0 { - if inc.Include[0] == '[' { - if err := json.Unmarshal(inc.Include, &includes); err != nil { - return nil, err - } - } else { - inc.Include = jsonutils.UnwrapString(inc.Include) - includes = strings.Split(string(inc.Include), " ") - } - } - return parseIncludes(content, includes, read) -} - -func parseIncludes(content []byte, includes []string, read readFnc) ([]byte, error) { - baseIsArray := jsonutils.IsJSONArray(content) - for _, inP := range includes { - c, err := read(normalizeTemplateName(inP)) - if err != nil { - return nil, err - } - includeContent, err := createFinalTemplate(c, read) - if err != nil { - return nil, err - } - isArray := jsonutils.IsJSONArray(includeContent) - if !baseIsArray && !isArray { - content, _ = jsonpatch.MergePatch(includeContent, content) - continue - } - if !baseIsArray { - content = jsonutils.Arrayify(content) - baseIsArray = true - } - if !isArray { - includeContent = jsonutils.Arrayify(includeContent) - } - content = jsonutils.MergeJSONArrays(content, includeContent) - } - return content, nil -} diff --git a/internal/utils/profile/template_test.go b/internal/utils/profile/template_test.go deleted file mode 100644 index 9b66656..0000000 --- a/internal/utils/profile/template_test.go +++ /dev/null @@ -1,1005 +0,0 @@ -package profile - -import ( - "bytes" - "os" - "reflect" - "testing" - "time" - - "github.com/oidc-mytoken/api/v0" - "github.com/oidc-mytoken/server/shared/utils" - "github.com/oidc-mytoken/server/shared/utils/unixtime" -) - -var profileTemplateDummyData = map[string]string{ - "/etc/mytoken/profiles.d/A": `{ - "name": "test_profile_A", - "rotation": "@A", - "capabilities": ["AT", "@basic"], - "restrictions": "example" - }`, - "~/.config/mytoken/profiles.d/B": `{ - "name": "test_profile_B", - "rotation": { - "include": ["1d", "revoke"], - "on_AT": true - }, - "capabilities": "AT @basic", - "restrictions": [{ - "scope": "openid profile", - "include": ["1d"] - }, - "example", - { - "include": "1d ip-this" - }] - }`, - "/etc/mytoken/profiles.d/nested": `{"include":["A","nested-B"]}`, - "/etc/mytoken/profiles.d/nested-B": `B`, - - "/etc/mytoken/rotation.d/A": `{ - "include":["1d"], - "on_other": true - }`, - "/etc/mytoken/rotation.d/1d": `{"lifetime":86400}`, - "/etc/mytoken/rotation.d/1h": `{"lifetime":3600}`, - "/etc/mytoken/rotation.d/revoke": `{"auto_revoke":true}`, - "~/.config/mytoken/rotation.d/revoke": `{"auto_revoke":false}`, - - "~/.config/mytoken/capabilities.d/basic": `["AT", "tokeninfo", "list_mytokens"]`, - - "/etc/mytoken/restrictions.d/example": `[{ - "scope": "openid profile email eduperson_entitlement storage.read", - "audience": ["https://storage.example.com"], - "usages_AT": 1, - "usages_other": 0 - }, { - "scope": "openid profile email eduperson_entitlement compute", - "audience": ["https://hpc.example.com"], - "usages_AT": 1, - "usages_other": 0 - }]`, - "/etc/mytoken/restrictions.d/ip-this": `{"ip":["this"]}`, - "/etc/mytoken/restrictions.d/1d": `{"exp":"+1d"}`, - "/etc/mytoken/restrictions.d/G": `{"exp":"+1d","nbf":"+1h"}`, - "~/.config/mytoken/restrictions.d/G": `{"exp":"+2d","usages_AT":1}`, -} - -func TestMain(m *testing.M) { - templateReader = newTemplateReader(readDummyData) - templateReader.userBaseDir = "~/.config/mytoken" - os.Exit(m.Run()) -} - -func readDummyData(path string) ([]byte, error) { - return []byte(profileTemplateDummyData[path]), nil -} - -func TestTemplateReader_ReadFile(t *testing.T) { - tests := []struct { - name string - path string - want []byte - wantErr bool - }{ - { - name: "read non-existing", - path: "does-not-exist", - want: nil, - wantErr: false, - }, - { - name: "read global", - path: "restrictions.d/1d", - want: []byte(profileTemplateDummyData["/etc/mytoken/restrictions.d/1d"]), - wantErr: false, - }, - { - name: "read user", - path: "capabilities.d/basic", - want: []byte(profileTemplateDummyData["~/.config/mytoken/capabilities.d/basic"]), - wantErr: false, - }, - { - name: "read both, user overwrites", - path: "rotation.d/revoke", - want: []byte(profileTemplateDummyData["~/.config/mytoken/rotation.d/revoke"]), - wantErr: false, - }, - { - name: "read both, combine", - path: "restrictions.d/G", - want: []byte(`{"exp":"+2d","nbf":"+1h","usages_AT":1}`), - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := templateReader.ReadFile(tt.path) - if (err != nil) != tt.wantErr { - t.Errorf("ReadFile() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !bytes.Equal(got, tt.want) { - t.Errorf("ReadFile() got = '%s', want '%s'", got, tt.want) - } - }, - ) - } -} - -func TestTemplateReader_readCapabilityTemplate(t *testing.T) { - tests := []struct { - name string - path string - want []byte - wantErr bool - }{ - { - name: "read non-existing", - path: "does-not-exist", - want: nil, - wantErr: false, - }, - { - name: "read", - path: "basic", - want: []byte(profileTemplateDummyData["~/.config/mytoken/capabilities.d/basic"]), - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := templateReader.readCapabilityTemplate(tt.path) - if (err != nil) != tt.wantErr { - t.Errorf("readCapabilityTemplate() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !bytes.Equal(got, tt.want) { - t.Errorf("readCapabilityTemplate() got = '%s', want '%s'", got, tt.want) - } - }, - ) - } -} - -func TestTemplateReader_readProfile(t *testing.T) { - tests := []struct { - name string - path string - want []byte - wantErr bool - }{ - { - name: "read non-existing", - path: "does-not-exist", - want: nil, - wantErr: false, - }, - { - name: "read", - path: "A", - want: []byte(profileTemplateDummyData["/etc/mytoken/profiles.d/A"]), - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := templateReader.readProfile(tt.path) - if (err != nil) != tt.wantErr { - t.Errorf("readProfile() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !bytes.Equal(got, tt.want) { - t.Errorf("readProfile() got = '%s', want '%s'", got, tt.want) - } - }, - ) - } -} - -func TestTemplateReader_readRestrictionsTemplate(t *testing.T) { - tests := []struct { - name string - path string - want []byte - wantErr bool - }{ - { - name: "read non-existing", - path: "does-not-exist", - want: nil, - wantErr: false, - }, - { - name: "read", - path: "example", - want: []byte(profileTemplateDummyData["/etc/mytoken/restrictions.d/example"]), - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := templateReader.readRestrictionsTemplate(tt.path) - if (err != nil) != tt.wantErr { - t.Errorf("readRestrictionsTemplate() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !bytes.Equal(got, tt.want) { - t.Errorf("readRestrictionsTemplate() got = '%s', want '%s'", got, tt.want) - } - }, - ) - } -} - -func TestTemplateReader_readRotationTemplate(t *testing.T) { - tests := []struct { - name string - path string - want []byte - wantErr bool - }{ - { - name: "read non-existing", - path: "does-not-exist", - want: nil, - wantErr: false, - }, - { - name: "read", - path: "revoke", - want: []byte(profileTemplateDummyData["~/.config/mytoken/rotation.d/revoke"]), - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := templateReader.readRotationTemplate(tt.path) - if (err != nil) != tt.wantErr { - t.Errorf("readRotationTemplate() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !bytes.Equal(got, tt.want) { - t.Errorf("readRotationTemplate() got = '%s', want '%s'", got, tt.want) - } - }, - ) - } -} - -func Test__parseCapabilityTemplate(t *testing.T) { - tests := []struct { - name string - content []byte - wantCapStrings []string - wantErr bool - }{ - { - name: "nil", - content: nil, - wantCapStrings: nil, - wantErr: false, - }, - { - name: "empty", - content: []byte{}, - wantCapStrings: nil, - wantErr: false, - }, - { - name: "string", - content: []byte("AT other"), - wantCapStrings: []string{ - "AT", - "other", - }, - wantErr: false, - }, - { - name: "array", - content: []byte(`["AT","other"]`), - wantCapStrings: []string{ - "AT", - "other", - }, - wantErr: false, - }, - { - name: "include in array", - content: []byte(`["@basic"]`), - wantCapStrings: []string{ - "AT", - "tokeninfo", - "list_mytokens", - }, - wantErr: false, - }, - { - name: "include as string", - content: []byte("@basic"), - wantCapStrings: []string{ - "AT", - "tokeninfo", - "list_mytokens", - }, - wantErr: false, - }, - { - name: "include in string with other", - content: []byte("@basic other"), - wantCapStrings: []string{ - "AT", - "tokeninfo", - "list_mytokens", - "other", - }, - wantErr: false, - }, - { - name: "include in array with other", - content: []byte(`["@basic", "other"]`), - wantCapStrings: []string{ - "AT", - "tokeninfo", - "list_mytokens", - "other", - }, - wantErr: false, - }, - { - name: "duplicates", - content: []byte(`["other", "@basic", "other", "AT"]`), - wantCapStrings: []string{ - "other", - "AT", - "tokeninfo", - "list_mytokens", - "other", - "AT", - }, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - gotCapStrings, err := _parseCapabilityTemplate(tt.content) - if (err != nil) != tt.wantErr { - t.Errorf("_parseCapabilityTemplate() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(gotCapStrings, tt.wantCapStrings) { - t.Errorf("_parseCapabilityTemplate() gotCapStrings = %v, want %v", gotCapStrings, tt.wantCapStrings) - } - }, - ) - } -} - -func Test__parseCapabilityTemplateByName(t *testing.T) { - tests := []struct { - name string - fullPath string - }{ - { - name: "non-existing", - fullPath: "/etc/mytoken/capabilities.d/non-existing", - }, - { - name: "basic", - fullPath: "~/.config/mytoken/capabilities.d/basic", - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - want, wantErr := _parseCapabilityTemplate([]byte(profileTemplateDummyData[tt.fullPath])) - got, err := _parseCapabilityTemplateByName(tt.name) - if err != nil && wantErr != nil && err.Error() != wantErr.Error() { - t.Errorf("_parseCapabilityTemplateByName() error = %v, wantErr %v", err, wantErr) - return - } - if !reflect.DeepEqual(got, want) { - t.Errorf("_parseCapabilityTemplateByName() got = %v, want %v", got, want) - } - }, - ) - } -} - -func Test_normalizeTemplateName(t *testing.T) { - tests := []struct { - name string - in string - want string - }{ - { - name: "empty", - in: "", - want: "", - }, - { - name: "without @", - in: "example", - want: "example", - }, - { - name: "with @", - in: "@example", - want: "example", - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - if got := normalizeTemplateName(tt.in); got != tt.want { - t.Errorf("normalizeTemplateName(\"%s\") = %v, want %v", tt.in, got, tt.want) - } - }, - ) - } -} - -func Test_parseCapabilityTemplate(t *testing.T) { - tests := []struct { - name string - content []byte - want api.Capabilities - wantErr bool - }{ - { - name: "nil", - content: nil, - want: nil, - wantErr: false, - }, - { - name: "empty", - content: []byte{}, - want: nil, - wantErr: false, - }, - { - name: "string", - content: []byte("AT tokeninfo"), - want: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - }, - ), - wantErr: false, - }, - { - name: "string with non-existing cap", - content: []byte("AT other"), - want: api.NewCapabilities( - []string{ - "AT", - "other", - }, - ), - wantErr: false, - }, - { - name: "array", - content: []byte(`["AT","tokeninfo"]`), - want: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - }, - ), - wantErr: false, - }, - { - name: "include in array", - content: []byte(`["@basic"]`), - want: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - "list_mytokens", - }, - ), - wantErr: false, - }, - { - name: "include as string", - content: []byte("@basic"), - want: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - "list_mytokens", - }, - ), - wantErr: false, - }, - { - name: "include in string with other", - content: []byte("@basic settings"), - want: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - "list_mytokens", - "settings", - }, - ), - wantErr: false, - }, - { - name: "include in array with other", - content: []byte(`["@basic", "settings"]`), - want: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - "list_mytokens", - "settings", - }, - ), - wantErr: false, - }, - { - name: "duplicates", - content: []byte(`["settings", "@basic", "settings", "AT"]`), - want: api.NewCapabilities( - []string{ - "settings", - "AT", - "tokeninfo", - "list_mytokens", - }, - ), - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := ParseCapabilityTemplate(tt.content) - if (err != nil) != tt.wantErr { - t.Errorf("ParseCapabilityTemplate() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("ParseCapabilityTemplate() got = %v, want %v", got, tt.want) - } - }, - ) - } -} - -func Test_parseProfile(t *testing.T) { - aProfile := api.GeneralMytokenRequest{ - Restrictions: exampleRestrictions, - Capabilities: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - "list_mytokens", - }, - ), - Name: "test_profile_A", - Rotation: &api.Rotation{ - Lifetime: 86400, - OnOther: true, - }, - } - bProfile := api.GeneralMytokenRequest{ - Restrictions: api.Restrictions{ - { - Scope: "openid profile", - ExpiresAt: int64(unixtime.InSeconds(86400)), - }, - exampleRestrictions[0], - exampleRestrictions[1], - { - ExpiresAt: int64(unixtime.InSeconds(86400)), - IPs: []string{"this"}, - }, - }, - Capabilities: api.NewCapabilities( - []string{ - "AT", - "tokeninfo", - "list_mytokens", - }, - ), - Name: "test_profile_B", - Rotation: &api.Rotation{ - Lifetime: 86400, - OnAT: true, - AutoRevoke: false, - }, - } - bProfile2 := api.GeneralMytokenRequest{ - Issuer: bProfile.Issuer, - GrantType: bProfile.GrantType, - Restrictions: bProfile.Restrictions, - Capabilities: bProfile.Capabilities, - Name: "changed", - ResponseType: bProfile.ResponseType, - MaxTokenLen: bProfile.MaxTokenLen, - Rotation: bProfile.Rotation, - } - - tests := []struct { - name string - content []byte - want api.GeneralMytokenRequest - wantErr bool - }{ - { - name: "nil", - content: nil, - want: api.GeneralMytokenRequest{}, - wantErr: false, - }, - { - name: "empty", - content: []byte{}, - want: api.GeneralMytokenRequest{}, - wantErr: false, - }, - { - name: "array", - content: []byte(`[{"name":"test"}]`), - want: api.GeneralMytokenRequest{}, - wantErr: true, - }, - { - name: "basics", - content: []byte(`{"name":"test"}`), - want: api.GeneralMytokenRequest{Name: "test"}, - wantErr: false, - }, - { - name: "single profile A", - content: []byte(`A`), - want: aProfile, - wantErr: false, - }, - { - name: "single profile B", - content: []byte(`B`), - want: bProfile, - wantErr: false, - }, - { - name: "adapted profile B", - content: []byte(`{"include":["B"],"name":"changed"}`), - want: bProfile2, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := ParseProfile(tt.content) - if (err != nil) != tt.wantErr { - t.Errorf("ParseProfile() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("ParseProfile() got = %+v, want %+v", got, tt.want) - } - }, - ) - } -} - -func Test_parseProfileByName(t *testing.T) { - tests := []struct { - name string - fullPath string - }{ - { - name: "non-existing", - fullPath: "/etc/mytoken/profiles.d/non-existing", - }, - { - name: "A", - fullPath: "/etc/mytoken/profiles.d/A", - }, - { - name: "B", - fullPath: "~/.config/mytoken/profiles.d/B", - }, - } - - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - want, wantErr := ParseProfile([]byte(profileTemplateDummyData[tt.fullPath])) - got, err := parseProfileByName(tt.name) - if err != nil && wantErr != nil && err.Error() != wantErr.Error() { - t.Errorf("parseProfileByName() error = %v, wantErr %v", err, wantErr) - return - } - if !reflect.DeepEqual(got, want) { - t.Errorf("parseProfileByName() got = %v, want %v", got, want) - } - }, - ) - } -} - -var exampleRestrictions = api.Restrictions{ - &api.Restriction{ - Scope: "openid profile email eduperson_entitlement storage.read", - Audiences: []string{"https://storage.example.com"}, - UsagesAT: utils.NewInt64(1), - UsagesOther: utils.NewInt64(0), - }, - &api.Restriction{ - Scope: "openid profile email eduperson_entitlement compute", - Audiences: []string{"https://hpc.example.com"}, - UsagesAT: utils.NewInt64(1), - UsagesOther: utils.NewInt64(0), - }, -} - -func Test_parseRestrictionsTemplate(t *testing.T) { - - tests := []struct { - name string - content []byte - want api.Restrictions - wantErr bool - }{ - { - name: "nil", - content: nil, - want: nil, - wantErr: false, - }, - { - name: "empty", - content: []byte{}, - want: nil, - wantErr: false, - }, - { - name: "object", - content: []byte(`{"usages_AT":1}`), - want: api.Restrictions{&api.Restriction{UsagesAT: utils.NewInt64(1)}}, - wantErr: false, - }, - { - name: "exp number", - content: []byte(`{"exp":1}`), - want: nil, - wantErr: true, - }, - { - name: "exp number string", - content: []byte(`{"exp":"1"}`), - want: api.Restrictions{&api.Restriction{ExpiresAt: 1}}, - wantErr: false, - }, - { - name: "exp 1d", - content: []byte(`{"exp":"+1d"}`), - want: api.Restrictions{&api.Restriction{ExpiresAt: time.Now().Add(time.Hour * 24).Unix()}}, - wantErr: false, - }, - { - name: "empty object", - content: []byte(`{}`), - want: api.Restrictions{}, - }, - { - name: "empty array", - content: []byte(`[]`), - want: api.Restrictions{}, - wantErr: false, - }, - { - name: "array", - content: []byte(`[{"usages_AT":1},{"scope":"openid profile"}]`), - want: api.Restrictions{ - &api.Restriction{UsagesAT: utils.NewInt64(1)}, - &api.Restriction{Scope: "openid profile"}, - }, - wantErr: false, - }, - { - name: "single template", - content: []byte(`example`), - want: exampleRestrictions, - wantErr: false, - }, - { - name: "single include in object without @", - content: []byte(`{"include":["example"]}`), - want: exampleRestrictions, - wantErr: false, - }, - { - name: "single include in object with @", - content: []byte(`{"include":["@example"]}`), - want: exampleRestrictions, - wantErr: false, - }, - { - name: "single include in array", - content: []byte(`[{"include":["@example"]}]`), - want: exampleRestrictions, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := ParseRestrictionsTemplate(tt.content) - if (err != nil) != tt.wantErr { - t.Errorf("ParseRestrictionsTemplate() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("ParseRestrictionsTemplate() got = %+v, want %+v", got, tt.want) - } - }, - ) - } -} - -func Test_parseRestrictionsTemplateByName(t *testing.T) { - tests := []struct { - name string - content string - }{ - { - name: "non-existing", - content: profileTemplateDummyData["/etc/mytoken/restrictions.d/non-existing"], - }, - { - name: "example", - content: profileTemplateDummyData["/etc/mytoken/restrictions.d/example"], - }, - { - name: "1d", - content: profileTemplateDummyData["/etc/mytoken/restrictions.d/1d"], - }, - { - name: "ip-this", - content: profileTemplateDummyData["/etc/mytoken/restrictions.d/ip-this"], - }, - { - name: "G", - content: `{"exp":"+2d","nbf":"+1h","usages_AT":1}`, - }, - } - - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - want, wantErr := ParseRestrictionsTemplate([]byte(tt.content)) - got, err := parseRestrictionsTemplateByName(tt.name) - if err != nil && wantErr != nil && err.Error() != wantErr.Error() { - t.Errorf("parseRestrictionsTemplateByName() error = %v, wantErr %v", err, wantErr) - return - } - if !reflect.DeepEqual(got, want) { - t.Errorf("parseRestrictionsTemplateByName() got = %+v, want %+v", got, want) - } - }, - ) - } -} - -func Test_parseRotationTemplate(t *testing.T) { - tests := []struct { - name string - content []byte - want *api.Rotation - wantErr bool - }{ - { - name: "nil", - content: nil, - want: nil, - wantErr: false, - }, - { - name: "empty", - content: []byte{}, - want: nil, - wantErr: false, - }, - { - name: "object with single claim", - content: []byte(`{"on_AT":true}`), - want: &api.Rotation{OnAT: true}, - wantErr: false, - }, - { - name: "array", - content: []byte(`[{"on_AT":true}]`), - want: nil, - wantErr: true, - }, - { - name: "single template name", - content: []byte(`1d`), - want: &api.Rotation{Lifetime: 86400}, - wantErr: false, - }, - { - name: "single template name with @", - content: []byte(`@1d`), - want: &api.Rotation{Lifetime: 86400}, - wantErr: false, - }, - { - name: "overwrite order", - content: []byte(`1d 1h`), - want: &api.Rotation{Lifetime: 86400}, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - got, err := ParseRotationTemplate(tt.content) - if (err != nil) != tt.wantErr { - t.Errorf("ParseRotationTemplate() error = %v, wantErr %v", err, tt.wantErr) - return - } - if err == nil && !reflect.DeepEqual(got, tt.want) { - t.Errorf("ParseRotationTemplate() got = %v, want %v", got, tt.want) - } - }, - ) - } -} - -func Test_parseRotationTemplateByName(t *testing.T) { - tests := []struct { - name string - fullPath string - }{ - { - name: "non-existing", - fullPath: "/etc/mytoken/rotation.d/non-existing", - }, - { - name: "A", - fullPath: "/etc/mytoken/rotation.d/A", - }, - { - name: "1d", - fullPath: "/etc/mytoken/rotation.d/1d", - }, - { - name: "revoke", - fullPath: "~/.config/mytoken/rotation.d/revoke", - }, - } - - for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - want, wantErr := ParseRotationTemplate([]byte(profileTemplateDummyData[tt.fullPath])) - got, err := parseRotationTemplateByName(tt.name) - if err != nil && wantErr != nil && err.Error() != wantErr.Error() { - t.Errorf("parseRotationTemplateByName() error = %v, wantErr %v", err, wantErr) - return - } - if !reflect.DeepEqual(got, want) { - t.Errorf("parseRotationTemplateByName() got = %v, want %v", got, want) - } - }, - ) - } -} diff --git a/internal/utils/timerestriction.go b/internal/utils/timerestriction.go deleted file mode 100644 index ab8ac61..0000000 --- a/internal/utils/timerestriction.go +++ /dev/null @@ -1,58 +0,0 @@ -package utils - -import ( - "encoding/json" - "strconv" - "time" - - "github.com/oidc-mytoken/api/v0" - "github.com/oidc-mytoken/server/shared/utils/unixtime" - - "github.com/oidc-mytoken/client/internal/utils/duration" -) - -func ParseTime(t string) (int64, error) { - if t == "" { - return 0, nil - } - i, err := strconv.ParseInt(t, 10, 64) - if err == nil { - if t[0] == '+' { - return int64(unixtime.InSeconds(i)), nil - } - return i, nil - } - if t[0] == '+' { - d, err := duration.ParseDuration(t[1:]) - return int64(unixtime.New(time.Now().Add(d))), err - } - tt, err := time.ParseInLocation("2006-01-02 15:04", t, time.Local) - return int64(unixtime.New(tt)), err -} - -type restrictionWT struct { - api.Restriction - ExpiresAt string `json:"exp"` - NotBefore string `json:"nbf"` -} - -type APIRestriction api.Restriction - -func (r *APIRestriction) UnmarshalJSON(data []byte) error { - rr := restrictionWT{} - if err := json.Unmarshal(data, &rr); err != nil { - return err - } - t, err := ParseTime(rr.ExpiresAt) - if err != nil { - return err - } - rr.Restriction.ExpiresAt = t - t, err = ParseTime(rr.NotBefore) - if err != nil { - return err - } - rr.Restriction.NotBefore = t - *r = APIRestriction(rr.Restriction) - return nil -} From 9135d3be25584a31d56299e5de93028486976d35 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 10:41:24 +0100 Subject: [PATCH 04/16] deprecate local profiles; use server profiles instead --- go.mod | 6 ++-- go.sum | 13 ++++---- internal/commands/info.go | 4 +-- internal/commands/mt.go | 59 +++++++++++++++++++++-------------- internal/commands/sshGrant.go | 2 +- 5 files changed, 49 insertions(+), 35 deletions(-) diff --git a/go.mod b/go.mod index 5d979f5..ed01e98 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,9 @@ require ( github.com/Songmu/prompter v0.5.1 github.com/gliderlabs/ssh v0.3.5 github.com/mdp/qrterminal/v3 v3.0.0 - github.com/oidc-mytoken/api v0.9.1 - github.com/oidc-mytoken/lib v0.6.1 - github.com/oidc-mytoken/utils v0.1.0 // indirect + github.com/oidc-mytoken/api v0.9.2-0.20221209132738-04f7ea8ceace + github.com/oidc-mytoken/lib v0.6.2-0.20221125141521-dae7f2a63fc2 + github.com/oidc-mytoken/utils v0.1.2 github.com/olekukonko/tablewriter v0.0.5 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.0 diff --git a/go.sum b/go.sum index d7c383b..f97ea22 100644 --- a/go.sum +++ b/go.sum @@ -215,13 +215,14 @@ github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= -github.com/oidc-mytoken/api v0.9.0/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= -github.com/oidc-mytoken/api v0.9.1 h1:Hmv+KaGyxiodf92mXjELFeZOa9tBsQnUyEoBAFQNls8= github.com/oidc-mytoken/api v0.9.1/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= -github.com/oidc-mytoken/lib v0.6.1 h1:ZtPj/1dc8rOf7VJlyCp3uBWEcEZJ7L2Ab50oI/ruoa4= -github.com/oidc-mytoken/lib v0.6.1/go.mod h1:AuKCljwZSdYfia6G6FvHl926pR/8ICyxrkbYKQgoGd4= -github.com/oidc-mytoken/utils v0.1.0 h1:Ia60CYjVzs4X35twdAB1NTXDyYjxe/IWDI/MkcvQHnc= -github.com/oidc-mytoken/utils v0.1.0/go.mod h1:pAUlvF/mYz8CjinCx4iwoWzG514B9EhuCpu7O+afaD8= +github.com/oidc-mytoken/api v0.9.2-0.20221125114557-91c7bae719ca/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= +github.com/oidc-mytoken/api v0.9.2-0.20221209132738-04f7ea8ceace h1:ys0wb2/DUgo1Ntibpy95+OFf7ejBnobbUTVYcRFwN2E= +github.com/oidc-mytoken/api v0.9.2-0.20221209132738-04f7ea8ceace/go.mod h1:AwWNrdctNj4z8iJBNWod/yCgRqaYHMJgc00QECHTu8U= +github.com/oidc-mytoken/lib v0.6.2-0.20221125141521-dae7f2a63fc2 h1:ygQMfCtOGnZxsW7cAhBZCSfGgg3qcfvPVkc2Wq+0L4A= +github.com/oidc-mytoken/lib v0.6.2-0.20221125141521-dae7f2a63fc2/go.mod h1:U0mC1zWdWKYPekoNTYSQZB5SHFk4fPz+JhfPgWs4TTs= +github.com/oidc-mytoken/utils v0.1.2 h1:nmKIw/k4OkQ/9ww06W7krJ4yTwvDbuCRCjjRCmI9gSE= +github.com/oidc-mytoken/utils v0.1.2/go.mod h1:pAUlvF/mYz8CjinCx4iwoWzG514B9EhuCpu7O+afaD8= 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/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/internal/commands/info.go b/internal/commands/info.go index af6b3f4..87fddfe 100644 --- a/internal/commands/info.go +++ b/internal/commands/info.go @@ -143,8 +143,8 @@ func history(_ *cli.Context) (err error) { updateMytoken(res.TokenUpdate.Mytoken) } } - outputData := make([]tablewriter.TableWriter, len(res.EventHistory)) - for i, d := range res.EventHistory { + outputData := make([]tablewriter.TableWriter, len(res.EventHistory.Events)) + for i, d := range res.EventHistory.Events { outputData[i] = tableEventEntry(d) } tablewriter.PrintTableData(outputData) diff --git a/internal/commands/mt.go b/internal/commands/mt.go index 9c7911a..cf6acce 100644 --- a/internal/commands/mt.go +++ b/internal/commands/mt.go @@ -1,6 +1,7 @@ package commands import ( + "encoding/json" "fmt" "os" "strings" @@ -8,6 +9,7 @@ import ( "github.com/oidc-mytoken/api/v0" mytokenlib "github.com/oidc-mytoken/lib" "github.com/oidc-mytoken/utils/utils" + "github.com/oidc-mytoken/utils/utils/jsonutils" "github.com/oidc-mytoken/utils/utils/profile" "github.com/oidc-mytoken/utils/utils/timerestriction" "github.com/urfave/cli/v2" @@ -87,7 +89,7 @@ func (opts *mtOpts) parseCapabilitiesOption() error { if opts.CapabilitiesStr == "" { return nil } - c, err := profile.ParseCapabilityTemplate([]byte(opts.CapabilitiesStr)) + c, err := profile.ProfileParser{}.ParseCapabilityTemplate([]byte(opts.CapabilitiesStr)) if err != nil { return err } @@ -102,21 +104,19 @@ func (opts *mtOpts) parseRotationOption() error { if rotStr == "" { return nil } - r, err := profile.ParseRotationTemplate([]byte(rotStr)) - if err != nil { - return err - } - if opts.request.Rotation == nil { - opts.request.Rotation = r - return nil + rotBytes := []byte(rotStr) + if jsonutils.IsJSONObject(rotBytes) { + if err := json.Unmarshal(rotBytes, opts.request.Rotation); err != nil { + return err + } + } else { + opts.request.Rotation = &api.Rotation{IncludedProfiles: strings.Split(rotStr, " ")} } - opts.request.Rotation.OnAT = opts.request.Rotation.OnAT || r.OnAT || opts.OnAT - opts.request.Rotation.OnOther = opts.request.Rotation.OnOther || r.OnOther || opts.OnOther - opts.request.Rotation.AutoRevoke = opts.request.Rotation.AutoRevoke || r.AutoRevoke || opts.AutoRevoke + opts.request.Rotation.OnAT = opts.request.Rotation.OnAT || opts.OnAT + opts.request.Rotation.OnOther = opts.request.Rotation.OnOther || opts.OnOther + opts.request.Rotation.AutoRevoke = opts.request.Rotation.AutoRevoke || opts.AutoRevoke if opts.Lifetime != 0 { opts.request.Rotation.Lifetime = opts.Lifetime - } else if r.Lifetime != 0 { - opts.request.Rotation.Lifetime = r.Lifetime } return nil } @@ -137,9 +137,20 @@ func parseRestrictionOpts(rOpts restrictionOpts, ctx *cli.Context) (api.Restrict func (opts *mtOpts) parseRestrictionOpts(ctx *cli.Context) (err error) { if opts.Restrictions != "" { - opts.request.Restrictions, err = profile.ParseRestrictionsTemplate([]byte(opts.Restrictions)) - if err != nil { - return + rBytes := []byte(opts.Restrictions) + if jsonutils.IsJSONObject(rBytes) { + rBytes = append([]byte{'['}, append(rBytes, ']')...) + } + if jsonutils.IsJSONArray(rBytes) { + if err = json.Unmarshal(rBytes, &opts.request.Restrictions); err != nil { + return + } + } else { + opts.request.Restrictions = api.Restrictions{ + { + IncludedProfiles: strings.Split(opts.Restrictions, " "), + }, + } } return } @@ -177,14 +188,16 @@ func (opts *mtOpts) Request(ctx *cli.Context) (*api.GeneralMytokenRequest, error if opts.request != nil { return opts.request, nil } - if opts.profile == "" { - opts.request = &api.GeneralMytokenRequest{} - } else { - r, err := profile.ParseProfile([]byte(opts.profile)) - if err != nil { - return nil, err + opts.request = &api.GeneralMytokenRequest{} + if opts.profile != "" { + bProf := []byte(opts.profile) + if jsonutils.IsJSONObject(bProf) { + if err := json.Unmarshal(bProf, &opts.request); err != nil { + return nil, err + } + } else { + opts.request.IncludedProfiles = strings.Split(opts.profile, " ") } - opts.request = &r } if opts.Name != "" { opts.request.Name = opts.Name diff --git a/internal/commands/sshGrant.go b/internal/commands/sshGrant.go index f4eceb4..6ade7c2 100644 --- a/internal/commands/sshGrant.go +++ b/internal/commands/sshGrant.go @@ -162,7 +162,7 @@ func addSSHKey(ctx *cli.Context) error { fmt.Fprintln(os.Stderr, "success") }, } - caps, err := profile.ParseCapabilityTemplate([]byte(optCapabilities)) + caps, err := profile.ProfileParser{}.ParseCapabilityTemplate([]byte(optCapabilities)) if err != nil { return err } From d46d3642d95faa9165c9d07d47881b70df83a383 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 10:43:17 +0100 Subject: [PATCH 05/16] remove local profiles --- .goreleaser.yml | 14 -------------- config/capabilities.d/all | 1 - config/capabilities.d/basic | 1 - config/profiles.d/agent | 3 --- config/restrictions.d/1d | 3 --- config/restrictions.d/1m | 3 --- config/restrictions.d/1w | 3 --- config/restrictions.d/1y | 3 --- config/restrictions.d/ip-this | 5 ----- config/rotation.d/AT | 1 - config/rotation.d/at | 3 --- config/rotation.d/auto-revoke | 3 --- config/rotation.d/daily | 3 --- config/rotation.d/monthly | 3 --- config/rotation.d/no-AT | 1 - config/rotation.d/no-at | 3 --- config/rotation.d/no-auto-revoke | 3 --- config/rotation.d/no-other | 3 --- config/rotation.d/other | 3 --- config/rotation.d/weekly | 3 --- 20 files changed, 65 deletions(-) delete mode 100644 config/capabilities.d/all delete mode 100644 config/capabilities.d/basic delete mode 100644 config/profiles.d/agent delete mode 100644 config/restrictions.d/1d delete mode 100644 config/restrictions.d/1m delete mode 100644 config/restrictions.d/1w delete mode 100644 config/restrictions.d/1y delete mode 100644 config/restrictions.d/ip-this delete mode 100644 config/rotation.d/AT delete mode 100644 config/rotation.d/at delete mode 100644 config/rotation.d/auto-revoke delete mode 100644 config/rotation.d/daily delete mode 100644 config/rotation.d/monthly delete mode 100644 config/rotation.d/no-AT delete mode 100644 config/rotation.d/no-at delete mode 100644 config/rotation.d/no-auto-revoke delete mode 100644 config/rotation.d/no-other delete mode 100644 config/rotation.d/other delete mode 100644 config/rotation.d/weekly diff --git a/.goreleaser.yml b/.goreleaser.yml index 806db4a..36bc472 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -44,20 +44,6 @@ nfpms: - src: config/example-config.yaml dst: /etc/mytoken/example-config.yaml type: config - - src: config/profiles.d/ - dst: /etc/mytoken/profiles.d/ - type: config - - src: config/capabilities.d/ - dst: /etc/mytoken/capabilities.d/ - type: config - - src: config/restrictions.d/ - dst: /etc/mytoken/restrictions.d/ - type: config - - src: config/rotation.d/ - dst: /etc/mytoken/rotation.d/ - type: config - - dst: /etc/mytoken/profiles.d/ - type: dir overrides: rpm: replacements: diff --git a/config/capabilities.d/all b/config/capabilities.d/all deleted file mode 100644 index 9d09d83..0000000 --- a/config/capabilities.d/all +++ /dev/null @@ -1 +0,0 @@ -AT tokeninfo create_mytoken list_mytokens revoke_any_token settings \ No newline at end of file diff --git a/config/capabilities.d/basic b/config/capabilities.d/basic deleted file mode 100644 index 08628b6..0000000 --- a/config/capabilities.d/basic +++ /dev/null @@ -1 +0,0 @@ -AT tokeninfo \ No newline at end of file diff --git a/config/profiles.d/agent b/config/profiles.d/agent deleted file mode 100644 index 1621e9d..0000000 --- a/config/profiles.d/agent +++ /dev/null @@ -1,3 +0,0 @@ -{ - "capabilities": "@all" -} \ No newline at end of file diff --git a/config/restrictions.d/1d b/config/restrictions.d/1d deleted file mode 100644 index 04b94c0..0000000 --- a/config/restrictions.d/1d +++ /dev/null @@ -1,3 +0,0 @@ -{ - "exp": "+1d" -} \ No newline at end of file diff --git a/config/restrictions.d/1m b/config/restrictions.d/1m deleted file mode 100644 index 99b6da5..0000000 --- a/config/restrictions.d/1m +++ /dev/null @@ -1,3 +0,0 @@ -{ - "exp": "+30d" -} \ No newline at end of file diff --git a/config/restrictions.d/1w b/config/restrictions.d/1w deleted file mode 100644 index 0a5bcbb..0000000 --- a/config/restrictions.d/1w +++ /dev/null @@ -1,3 +0,0 @@ -{ - "exp": "+1w" -} \ No newline at end of file diff --git a/config/restrictions.d/1y b/config/restrictions.d/1y deleted file mode 100644 index d849548..0000000 --- a/config/restrictions.d/1y +++ /dev/null @@ -1,3 +0,0 @@ -{ - "exp": "+1y" -} \ No newline at end of file diff --git a/config/restrictions.d/ip-this b/config/restrictions.d/ip-this deleted file mode 100644 index be07f5b..0000000 --- a/config/restrictions.d/ip-this +++ /dev/null @@ -1,5 +0,0 @@ -{ - "hosts": [ - "this" - ] -} \ No newline at end of file diff --git a/config/rotation.d/AT b/config/rotation.d/AT deleted file mode 100644 index a62623f..0000000 --- a/config/rotation.d/AT +++ /dev/null @@ -1 +0,0 @@ -at \ No newline at end of file diff --git a/config/rotation.d/at b/config/rotation.d/at deleted file mode 100644 index a477de2..0000000 --- a/config/rotation.d/at +++ /dev/null @@ -1,3 +0,0 @@ -{ - "on_AT": true -} \ No newline at end of file diff --git a/config/rotation.d/auto-revoke b/config/rotation.d/auto-revoke deleted file mode 100644 index 6e11d05..0000000 --- a/config/rotation.d/auto-revoke +++ /dev/null @@ -1,3 +0,0 @@ -{ - "auto_revoke": true -} \ No newline at end of file diff --git a/config/rotation.d/daily b/config/rotation.d/daily deleted file mode 100644 index cde717f..0000000 --- a/config/rotation.d/daily +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lifetime": 86400 -} \ No newline at end of file diff --git a/config/rotation.d/monthly b/config/rotation.d/monthly deleted file mode 100644 index f6822b8..0000000 --- a/config/rotation.d/monthly +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lifetime": 2592000 -} \ No newline at end of file diff --git a/config/rotation.d/no-AT b/config/rotation.d/no-AT deleted file mode 100644 index 4fc11a6..0000000 --- a/config/rotation.d/no-AT +++ /dev/null @@ -1 +0,0 @@ -no-at \ No newline at end of file diff --git a/config/rotation.d/no-at b/config/rotation.d/no-at deleted file mode 100644 index 72caa97..0000000 --- a/config/rotation.d/no-at +++ /dev/null @@ -1,3 +0,0 @@ -{ - "on_AT": false -} \ No newline at end of file diff --git a/config/rotation.d/no-auto-revoke b/config/rotation.d/no-auto-revoke deleted file mode 100644 index 4814941..0000000 --- a/config/rotation.d/no-auto-revoke +++ /dev/null @@ -1,3 +0,0 @@ -{ - "auto_revoke": false -} \ No newline at end of file diff --git a/config/rotation.d/no-other b/config/rotation.d/no-other deleted file mode 100644 index be1db6e..0000000 --- a/config/rotation.d/no-other +++ /dev/null @@ -1,3 +0,0 @@ -{ - "on_other": false -} \ No newline at end of file diff --git a/config/rotation.d/other b/config/rotation.d/other deleted file mode 100644 index e4b9716..0000000 --- a/config/rotation.d/other +++ /dev/null @@ -1,3 +0,0 @@ -{ - "on_other": true -} \ No newline at end of file diff --git a/config/rotation.d/weekly b/config/rotation.d/weekly deleted file mode 100644 index cac6043..0000000 --- a/config/rotation.d/weekly +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lifetime": 604800 -} From 293586eefe50807432c4c3e11b0a30682a066554 Mon Sep 17 00:00:00 2001 From: Gabriel Zachmann Date: Thu, 12 Jan 2023 11:58:36 +0100 Subject: [PATCH 06/16] Ci (#28) add ci --- .github/workflows/go.yml | 38 ---------- .github/workflows/release.yaml | 28 -------- .gitlab-ci-scripts/goreleaser.sh | 19 +++++ .gitlab-ci-scripts/set-prerel-version.sh | 54 ++++++++++++++ .gitlab-ci-scripts/upload.sh | 41 +++++++++++ .gitlab-ci.yml | 69 ++++++++++++++++++ .goreleaser-release.yml | 92 ++++++++++++++++++++++++ .goreleaser.yml | 30 +++++++- cmd/mytoken/DOCKERFILE | 6 ++ cmd/mytoken/main.go | 2 +- internal/commands/options.go | 2 +- internal/model/version/VERSION | 1 + internal/model/version/version.go | 39 ++++++---- staticcheck.conf | 1 + 14 files changed, 338 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/go.yml delete mode 100644 .github/workflows/release.yaml create mode 100755 .gitlab-ci-scripts/goreleaser.sh create mode 100755 .gitlab-ci-scripts/set-prerel-version.sh create mode 100755 .gitlab-ci-scripts/upload.sh create mode 100644 .gitlab-ci.yml create mode 100644 .goreleaser-release.yml create mode 100644 cmd/mytoken/DOCKERFILE create mode 100644 internal/model/version/VERSION create mode 100644 staticcheck.conf diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index eeb7930..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Go - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - - build: - name: Build - runs-on: ubuntu-latest - steps: - - - name: Set up Go 1.14 - uses: actions/setup-go@v2 - with: - go-version: ^1.14 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: Build Client - run: go build -v github.com/oidc-mytoken/client/cmd/mytoken - - - name: Test - run: go test -v ./... - diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index bfdc5f9..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: goreleaser -on: - push: - tags: - - "v*.*.*" - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.16 - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitlab-ci-scripts/goreleaser.sh b/.gitlab-ci-scripts/goreleaser.sh new file mode 100755 index 0000000..d934366 --- /dev/null +++ b/.gitlab-ci-scripts/goreleaser.sh @@ -0,0 +1,19 @@ +mkdir ../shared +first=$(grep '^## ' -nm1 CHANGELOG.md | cut -d':' -f1); \ + second=$(grep '^## ' -nm2 CHANGELOG.md | tail -n1 | cut -d':' -f1); \ + tail -n+$first CHANGELOG.md | head -n$(($second-$first)) > ../shared/release.md +GORELEASER_CONFIG=".goreleaser.yml" +if [ -n "$CI_COMMIT_TAG" ] && echo "$CI_COMMIT_TAG" | grep -qv '~'; then +GORELEASER_CONFIG=".goreleaser-release.yml" +fi +BASEDIR=/go/src/github.com/oidc-mytoken/client +docker run --rm --privileged \ + -v "$PWD":"$BASEDIR" \ + -w "$BASEDIR" \ + -v "${PWD}/../shared":/tmp/shared \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -e DOCKER_USERNAME -e DOCKER_PASSWORD \ + -e GITHUB_TOKEN \ + -e GORELEASER_CONFIG \ + goreleaser/goreleaser release -f $GORELEASER_CONFIG --release-notes /tmp/shared/release.md +ls -l results \ No newline at end of file diff --git a/.gitlab-ci-scripts/set-prerel-version.sh b/.gitlab-ci-scripts/set-prerel-version.sh new file mode 100755 index 0000000..c36cde4 --- /dev/null +++ b/.gitlab-ci-scripts/set-prerel-version.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +DEVSTRING="pr" +VERSION_FILE=internal/model/version/VERSION + +while [ $# -gt 0 ]; do + case $1 in + --devstring) + DEVSTRING="$2" + shift # past argument + shift # past value + ;; + --version_file) + VERSION_FILE="$2" + shift # past argument + shift # past value + ;; + --*|-*) + echo "Unknown option $1" + exit 1 + ;; + esac +done + +git config user.email || { + echo "Setting up git in CI" + git config --global --add safe.directory "$PWD" + git config user.email "ci@repo.data.kit.edu" + git config user.name "cicd" +} + +# Get master branch name: +# use origin if exists +# else use last found remote +REMOTES=$(git remote show) +for R in $REMOTES; do + MASTER=master + MASTER_BRANCH="refs/remotes/${R}/${MASTER}" + #echo "Master-branch: ${MASTER_BRANCH}" + [ "x${R}" = "xorigin" ] && break +done + +PREREL=$(git rev-list --count HEAD ^"$MASTER_BRANCH") + +# use version file: +VERSION=$(cat "$VERSION_FILE") +PR_VERSION="${VERSION}-${DEVSTRING}${PREREL}" +echo "$PR_VERSION" > "$VERSION_FILE" +echo "$PR_VERSION" + +echo "$PR_VERSION" > "$VERSION_FILE" +git add "$VERSION_FILE" +git commit -m "dummy prerel version" +git tag "v${PR_VERSION}" diff --git a/.gitlab-ci-scripts/upload.sh b/.gitlab-ci-scripts/upload.sh new file mode 100755 index 0000000..acd456b --- /dev/null +++ b/.gitlab-ci-scripts/upload.sh @@ -0,0 +1,41 @@ + +REPO_TARGET="/prerel" +if [ -n "$CI_COMMIT_TAG" ] && echo "$CI_COMMIT_TAG" | grep -qv '~'; then + REPO_TARGET="/preprod" +fi + +# ssh-key-script +[ -e /tmp/ssh-private-keys/${REPO_USER} ] && { + eval $(ssh-agent -s) + cat /tmp/ssh-private-keys/${REPO_USER} | tr -d '\r' | ssh-add - + test -d ~/.ssh || mkdir -p ~/.ssh + chmod 700 ~/.ssh +} +[ -e /tmp/ssh-private-keys/known_hosts ] && { + test -d ~/.ssh || mkdir -p ~/.ssh + cp /tmp/ssh-private-keys/known_hosts ~/.ssh/known_hosts + chmod 644 ~/.ssh/known_hosts +} +ssh-add -l +ssh -o StrictHostKeyChecking=no "${REPO_USER}@${REPO_HOST}" "hostname -f" + +# sign-repo function +sign_repos() { + ssh "${REPO_USER}@${REPO_HOST}" "~/ci-voodoo/ci-tools/sign-all-repos.sh -t ${REPO_TARGET}" +} + +upload_files() { + UPLOAD_DIR=/tmp/package-upload + ssh "${REPO_USER}@${REPO_HOST}" "rm -rf $UPLOAD_DIR && mkdir -p $UPLOAD_DIR" + scp results/* "${REPO_USER}@${REPO_HOST}:${UPLOAD_DIR}" +} + +distribute_files() { + ssh "${REPO_USER}@${REPO_HOST}" "~/ci-voodoo/ci-tools/distribute-local-packages.sh -t ${REPO_TARGET} -w mytoken" +} + + +# upload and sign +upload_files +distribute_files +sign_repos diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3857436 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,69 @@ +image: golang:1.16 +stages: + - build + - test + - lint + - release + +default: + tags: + - linux + cache: + paths: + - .cache + + +before_script: + - mkdir -p .cache + - export GOPATH=${CI_PROJECT_DIR}/.cache + +test: + stage: test + script: + - go test -v ./... + +test_race: + stage: test + script: + - go test -race -v ./... + +staticcheck: + stage: lint + before_script: + - go install honnef.co/go/tools/cmd/staticcheck@latest + script: + - staticcheck ./... + +vet: + stage: lint + script: + - go vet ./... + +build: + stage: build + script: + - go build github.com/oidc-mytoken/client/cmd/mytoken + +prerelease: + stage: release + image: + name: docker:stable + services: + - docker:dind + only: + refs: + - tags + - prerel + tags: + - linux + variables: + GIT_STRATEGY: clone + GIT_DEPTH: 0 + REPO_HOST: repo.data.kit.edu + REPO_USER: cicd + script: + - if [ -z "$CI_COMMIT_TAG" ]; then docker run --rm -v $PWD:/tmp/mytoken -w /tmp/mytoken bitnami/git .gitlab-ci-scripts/set-prerel-version.sh; fi; + - .gitlab-ci-scripts/goreleaser.sh + - .gitlab-ci-scripts/upload.sh + after_script: + - docker run --rm curlimages/curl -d "repo=github.com/oidc-mytoken/client" https://goreportcard.com/checks diff --git a/.goreleaser-release.yml b/.goreleaser-release.yml new file mode 100644 index 0000000..e38eb3f --- /dev/null +++ b/.goreleaser-release.yml @@ -0,0 +1,92 @@ +project_name: mytoken +before: + hooks: + - go mod tidy +dist: results +builds: + - id: client + main: ./cmd/mytoken/main.go + binary: mytoken + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + ignore: + - goos: windows + goarch: arm64 + flags: + - -trimpath + mod_timestamp: '{{ .CommitTimestamp }}' +archives: + - replacements: + darwin: macOS + 386: 32-bit + amd64: 64-bit + format_overrides: + - goos: windows + format: zip +nfpms: + - id: client-pkg + package_name: mytoken + replacements: + 386: i386 + file_name_template: "{{ .PackageName }}_{{ .Version }}_{{ .Arch }}" + builds: + - client + homepage: https://mytoken-docs.data.kit.edu/ + maintainer: Gabriel Zachmann + description: Mytoken is a command line client for the central web service mytoken. It can be used to easily obtain OpenID Connect access tokens across devices. + license: MIT + formats: + - deb + - rpm + release: 1 + section: misc + bindir: /usr/bin + contents: + - src: config/example-config.yaml + dst: /etc/mytoken/example-config.yaml + type: config + overrides: + rpm: + replacements: + amd64: x86_64 + file_name_template: "{{ .PackageName }}-{{ .Version }}.{{ .Arch }}" +dockers: + - goos: linux + goarch: amd64 + ids: + - client + image_templates: + - "oidcmytoken/mytoken:latest" + - "oidcmytoken/mytoken:{{ .Tag }}" + - "oidcmytoken/mytoken:{{ .Major }}" + - "oidcmytoken/mytoken:{{ .Major }}.{{ .Minor }}" + dockerfile: cmd/mytoken/Dockerfile + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title=mytoken" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +release: + disable: true + prerelease: auto + draft: true + github: + owner: oidc-mytoken + name: client + name_template: "{{.ProjectName}} {{.Version}}" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/.goreleaser.yml b/.goreleaser.yml index 36bc472..86ba49a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,6 +2,7 @@ project_name: mytoken before: hooks: - go mod tidy +dist: results builds: - id: client main: ./cmd/mytoken/main.go @@ -15,6 +16,9 @@ builds: ignore: - goos: windows goarch: arm64 + flags: + - -trimpath + mod_timestamp: '{{ .CommitTimestamp }}' archives: - replacements: darwin: macOS @@ -40,6 +44,7 @@ nfpms: - rpm release: 1 section: misc + bindir: /usr/bin contents: - src: config/example-config.yaml dst: /etc/mytoken/example-config.yaml @@ -49,13 +54,34 @@ nfpms: replacements: amd64: x86_64 file_name_template: "{{ .PackageName }}-{{ .Version }}.{{ .Arch }}" +dockers: + - goos: linux + goarch: amd64 + ids: + - client + image_templates: + - "oidcmytoken/mytoken:unstable" + - "oidcmytoken/mytoken:{{ .Tag }}" + dockerfile: cmd/mytoken/Dockerfile + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title=mytoken" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + checksum: name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" release: + disable: true + prerelease: auto draft: true + github: + owner: oidc-mytoken + name: client name_template: "{{.ProjectName}} {{.Version}}" -snapshot: - name_template: "{{ .Version }}+devel" changelog: sort: asc filters: diff --git a/cmd/mytoken/DOCKERFILE b/cmd/mytoken/DOCKERFILE new file mode 100644 index 0000000..db9b3a4 --- /dev/null +++ b/cmd/mytoken/DOCKERFILE @@ -0,0 +1,6 @@ +FROM debian:stable +WORKDIR /mytoken +COPY mytoken /usr/bin/mytoken +USER 1000:1000 +ENTRYPOINT ["mytoken"] +CMD ["AT"] diff --git a/cmd/mytoken/main.go b/cmd/mytoken/main.go index e96e6ff..5f41a58 100644 --- a/cmd/mytoken/main.go +++ b/cmd/mytoken/main.go @@ -15,7 +15,7 @@ import ( var ctx = context.Background() func init() { - ctx = context.WithValue(ctx, mytokenlib.ContextKeyUserAgent, fmt.Sprintf("mytoken client %s", version.VERSION())) + ctx = context.WithValue(ctx, mytokenlib.ContextKeyUserAgent, fmt.Sprintf("mytoken client %s", version.VERSION)) } func main() { diff --git a/internal/commands/options.go b/internal/commands/options.go index f1a9671..b14991f 100644 --- a/internal/commands/options.go +++ b/internal/commands/options.go @@ -15,7 +15,7 @@ import ( var app = &cli.App{ Name: "mytoken", Usage: "Command line client for the mytoken server", - Version: version.VERSION(), + Version: version.VERSION, Compiled: time.Time{}, Authors: []*cli.Author{ { diff --git a/internal/model/version/VERSION b/internal/model/version/VERSION new file mode 100644 index 0000000..09a3acf --- /dev/null +++ b/internal/model/version/VERSION @@ -0,0 +1 @@ +0.6.0 \ No newline at end of file diff --git a/internal/model/version/version.go b/internal/model/version/version.go index f288640..cedb591 100644 --- a/internal/model/version/version.go +++ b/internal/model/version/version.go @@ -1,24 +1,35 @@ package version import ( - "fmt" + _ "embed" // for go:embed + "strconv" + "strings" ) +// VERSION holds the server's version +// +//go:embed VERSION +var VERSION string + // Version segments -const ( - MAJOR = 0 - MINOR = 5 - FIX = 3 - DEV = false +var ( + MAJOR int + MINOR int + FIX int + PRE int ) -var version = fmt.Sprintf("%d.%d.%d", MAJOR, MINOR, FIX) -var devVersion = fmt.Sprintf("%s-dev", version) - -// VERSION returns the current mytoken version -func VERSION() string { - if DEV { - return devVersion +func init() { + if VERSION[len(VERSION)-1] == '\n' { + VERSION = VERSION[:len(VERSION)-1] + } + v := strings.Split(VERSION, ".") + MAJOR, _ = strconv.Atoi(v[0]) + MINOR, _ = strconv.Atoi(v[1]) + ps := strings.Split(v[2], "-") + FIX, _ = strconv.Atoi(ps[0]) + if len(ps) > 1 { + pre := strings.TrimPrefix(ps[1], "pr") + PRE, _ = strconv.Atoi(pre) } - return version } diff --git a/staticcheck.conf b/staticcheck.conf new file mode 100644 index 0000000..08b5544 --- /dev/null +++ b/staticcheck.conf @@ -0,0 +1 @@ +checks = ["inherit", "ST1003", "ST1016", "ST1020", "ST1021"] From b6a92798ee2989fe5dc8fc46355fef76dc76e2e5 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 12:58:10 +0100 Subject: [PATCH 07/16] fix staticcheck --- staticcheck.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticcheck.conf b/staticcheck.conf index 08b5544..0706bae 100644 --- a/staticcheck.conf +++ b/staticcheck.conf @@ -1 +1 @@ -checks = ["inherit", "ST1003", "ST1016", "ST1020", "ST1021"] +checks = ["inherit", "ST1003", "ST1016", "ST1020", "ST1021", "-ST1005"] From bccf8bc17513b1ea269d7a6f5a1c2ee90fc808e3 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 13:08:32 +0100 Subject: [PATCH 08/16] [ci] fix staticcheck go version in --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3857436..41ef2d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,6 +28,7 @@ test_race: - go test -race -v ./... staticcheck: + image: golang:1.19 stage: lint before_script: - go install honnef.co/go/tools/cmd/staticcheck@latest From 5b82075f18d5e8003779853bf5f3ae5651872596 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 13:10:55 +0100 Subject: [PATCH 09/16] code improvements --- internal/commands/mt.go | 2 +- internal/config/config.go | 2 +- internal/utils/logger/logger.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/commands/mt.go b/internal/commands/mt.go index cf6acce..c16d610 100644 --- a/internal/commands/mt.go +++ b/internal/commands/mt.go @@ -70,7 +70,7 @@ func (opts *mtOpts) parseProviderOpt() error { return fmt.Errorf("Provider not specified and no default provider set") } } - if isURL := strings.HasPrefix(opts.provider, "https://"); isURL { + if strings.HasPrefix(opts.provider, "https://") { opts.request.Issuer = opts.provider return nil } diff --git a/internal/config/config.go b/internal/config/config.go index 4124916..08f9207 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -72,7 +72,7 @@ func LoadDefault() { } // Load loads the config form the provided filepath -func Load(file string) { +func Load(file string) { // skipcq RVV-B0001 filename := filepath.Base(file) path := filepath.Dir(file) load(filename, []string{path}) diff --git a/internal/utils/logger/logger.go b/internal/utils/logger/logger.go index df7ec0e..43b9661 100644 --- a/internal/utils/logger/logger.go +++ b/internal/utils/logger/logger.go @@ -18,7 +18,7 @@ func Init() { type errorStringFormatter struct{} // Format implements the logrus.Formatter interface -func (f *errorStringFormatter) Format(entry *log.Entry) ([]byte, error) { +func (*errorStringFormatter) Format(entry *log.Entry) ([]byte, error) { b := bytes.Buffer{} b.WriteString(entry.Message) if len(entry.Data) > 0 { From a7880586807c472464571ff9141540d1c12c2ded Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 13:29:38 +0100 Subject: [PATCH 10/16] add changelog --- CHANGELOG.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0b2d26c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,75 @@ + +## mytoken 0.6.0 PREREL + +### Breaking Changes +- Support for local profiles / templates is dropped. Instead, support for server profiles is added. + +### Features +- Added support for server-side profiles / templates + +### API +- Adapt to newest api + +### Bugfixes +- Fixed the geoip allow and disallow command line options + +## mytoken 0.5.2 +- Added qr code to oidc flow +- Added application name to request + +## mytoken 0.5.1 +- bump json patch +- fixed `stdout` printing bug on windows + +## mytoken 0.5.0 +- Adapt to API +- Drop support for subtoken_capabilities +- Drop support for token management +- Add support for profiles & templates +- Add support for WLCG Bearer token discovery + +## mytoken 0.4.2 +- adapt to api 0.7 + +## mytoken 0.4.1 +- adapt to api / lib changes + +## mytoken 0.4.0 +- Adapt to api and server version 0.4.0 +- Improve some outputs with tables instead of json +- Add support for token rotation +- Add rename command +- Delete a mytoken from the tokens file on revocation if it is stored there +- Fix command line falgs position with subcommands +- Implement settings / user grants / ssh key list, upload, deletion +- Implement actions through ssh + +## mytoken 0.3.0 +- Changed cli lib; improved help output formatting + +## mytoken 0.2.0 +Mytoken 0.2.0 has the following features +- Obtain mytokens + - Through authorization code flow + - Through mytoken + - Through transfer code + - Support for native application (polling codes) +- Obtain access tokens +- Tokeninfo +- Token Revocation + + +## mytoken 0.1.0 +This is the first release of the mytoken command line client. +mytoken is still under active development and is not yet considered stable. + +The first release supports the following important features: + +- Obtain and store super token +- Obtain super token for usage somewhere else +- Obtain access token from super token +- Token revocation +- Super token can be created from another super token or the authorization code flow +- Super tokens can be restricted +- Content of a super token can be printed +- Super tokens are encrypted with a password or gpg key From 00b956eceb32ef5d62c38987ef69bb96560922bd Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 13:40:26 +0100 Subject: [PATCH 11/16] [ci] fix ci --- .gitlab-ci-scripts/goreleaser.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci-scripts/goreleaser.sh b/.gitlab-ci-scripts/goreleaser.sh index d934366..d0fbda4 100755 --- a/.gitlab-ci-scripts/goreleaser.sh +++ b/.gitlab-ci-scripts/goreleaser.sh @@ -1,4 +1,4 @@ -mkdir ../shared +mkdir -p ../shared first=$(grep '^## ' -nm1 CHANGELOG.md | cut -d':' -f1); \ second=$(grep '^## ' -nm2 CHANGELOG.md | tail -n1 | cut -d':' -f1); \ tail -n+$first CHANGELOG.md | head -n$(($second-$first)) > ../shared/release.md From 0102780a136aa2ab6b26a8152da5c697421a1136 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 13:46:08 +0100 Subject: [PATCH 12/16] [ci] fix ci --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2214f8f..c14312b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ config/config.yaml config/config-dev.yaml /cmd/test dist/ +.cache/ From 8645e5af3fa5215513c3c21ff5560e639a3a6ce5 Mon Sep 17 00:00:00 2001 From: zachmann Date: Thu, 12 Jan 2023 14:03:28 +0100 Subject: [PATCH 13/16] [ci] fix ci: rename docker file --- cmd/mytoken/{DOCKERFILE => Dockerfile} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cmd/mytoken/{DOCKERFILE => Dockerfile} (100%) diff --git a/cmd/mytoken/DOCKERFILE b/cmd/mytoken/Dockerfile similarity index 100% rename from cmd/mytoken/DOCKERFILE rename to cmd/mytoken/Dockerfile From 2a2a0892fd150834b22dfd83be32c15e40f5c864 Mon Sep 17 00:00:00 2001 From: zachmann Date: Tue, 17 Jan 2023 10:44:32 +0100 Subject: [PATCH 14/16] fix profile usage with default capabilities --- internal/commands/mt.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/commands/mt.go b/internal/commands/mt.go index c16d610..de82beb 100644 --- a/internal/commands/mt.go +++ b/internal/commands/mt.go @@ -224,7 +224,7 @@ func (opts *mtOpts) Request(ctx *cli.Context) (*api.GeneralMytokenRequest, error if err != nil { return nil, err } - if len(opts.request.Capabilities) == 0 { + if len(opts.request.Capabilities) == 0 && len(opts.request.IncludedProfiles) == 0 { opts.request.Capabilities = api.NewCapabilities(config.Get().DefaultTokenCapabilities) } return opts.request, nil @@ -502,10 +502,12 @@ func obtainMT(context *cli.Context) (string, error) { } mtGrant := mtCommand.GetToken() if mtGrant != "" && !mtCommand.UseOIDCFlow { - - mtRes, err := mytoken.Mytoken.APIFromMytoken( - mtGrant, req.Issuer, req.Restrictions, req.Capabilities, - req.Rotation, req.ResponseType, req.Name, + req.GrantType = api.GrantTypeMytoken + mtRes, err := mytoken.Mytoken.APIFromRequest( + api.MytokenFromMytokenRequest{ + GeneralMytokenRequest: *req, + Mytoken: mtGrant, + }, ) if err != nil { return "", err From 106c557111fe3cb9ededdfdf03723652c1a444ee Mon Sep 17 00:00:00 2001 From: zachmann Date: Tue, 17 Jan 2023 11:29:23 +0100 Subject: [PATCH 15/16] 2023 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index e69feab..5663c58 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2022 Gabriel Zachmann +Copyright (c) 2020-2023 Gabriel Zachmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From e81c0a7085430391269bfd71589c2da908425574 Mon Sep 17 00:00:00 2001 From: zachmann Date: Tue, 17 Jan 2023 12:07:00 +0100 Subject: [PATCH 16/16] bump api and lib --- go.mod | 4 ++-- go.sum | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index ed01e98..5d0c13c 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/Songmu/prompter v0.5.1 github.com/gliderlabs/ssh v0.3.5 github.com/mdp/qrterminal/v3 v3.0.0 - github.com/oidc-mytoken/api v0.9.2-0.20221209132738-04f7ea8ceace - github.com/oidc-mytoken/lib v0.6.2-0.20221125141521-dae7f2a63fc2 + github.com/oidc-mytoken/api v0.10.0 + github.com/oidc-mytoken/lib v0.7.0 github.com/oidc-mytoken/utils v0.1.2 github.com/olekukonko/tablewriter v0.0.5 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index f97ea22..2caad21 100644 --- a/go.sum +++ b/go.sum @@ -216,11 +216,10 @@ github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxO github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= github.com/oidc-mytoken/api v0.9.1/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= -github.com/oidc-mytoken/api v0.9.2-0.20221125114557-91c7bae719ca/go.mod h1:DBIlUbaIgGlf607VZx8zFC97VR3WNN0kaMVO1AqyTdE= -github.com/oidc-mytoken/api v0.9.2-0.20221209132738-04f7ea8ceace h1:ys0wb2/DUgo1Ntibpy95+OFf7ejBnobbUTVYcRFwN2E= -github.com/oidc-mytoken/api v0.9.2-0.20221209132738-04f7ea8ceace/go.mod h1:AwWNrdctNj4z8iJBNWod/yCgRqaYHMJgc00QECHTu8U= -github.com/oidc-mytoken/lib v0.6.2-0.20221125141521-dae7f2a63fc2 h1:ygQMfCtOGnZxsW7cAhBZCSfGgg3qcfvPVkc2Wq+0L4A= -github.com/oidc-mytoken/lib v0.6.2-0.20221125141521-dae7f2a63fc2/go.mod h1:U0mC1zWdWKYPekoNTYSQZB5SHFk4fPz+JhfPgWs4TTs= +github.com/oidc-mytoken/api v0.10.0 h1:+LCMb7et/roU+Baifho9bcOOAoqDzMSOJt4T1EgI5nk= +github.com/oidc-mytoken/api v0.10.0/go.mod h1:DS2/0gUjt84jVq/4jqs7mSoUtv1DDEp3xexF7HW1qe4= +github.com/oidc-mytoken/lib v0.7.0 h1:/uPQ10ColbCZ79wotV6aa3yfU6Lbaucis2+TrfVIXdQ= +github.com/oidc-mytoken/lib v0.7.0/go.mod h1:D0vrMn1szss52mJKwI+sTsSakVCP6qCk0l0kAjd4YtA= github.com/oidc-mytoken/utils v0.1.2 h1:nmKIw/k4OkQ/9ww06W7krJ4yTwvDbuCRCjjRCmI9gSE= github.com/oidc-mytoken/utils v0.1.2/go.mod h1:pAUlvF/mYz8CjinCx4iwoWzG514B9EhuCpu7O+afaD8= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= @@ -242,13 +241,15 @@ github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.41.0 h1:zeR0Z1my1wDHTRiamBCXVglQdbUwgb9uWG3k1HQz6jY=