From 050fab05f4d45afcf91338676ce4d21ad8c4cfe6 Mon Sep 17 00:00:00 2001 From: Daniel Adam Date: Fri, 1 Mar 2024 12:46:46 +0100 Subject: [PATCH 1/5] Update GitHub actions golangci/golangci-lint-action: v3 -> v4 --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index e2a5dd09..b380dd0e 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,7 +26,7 @@ jobs: - run: go version - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: latest args: --timeout=5m From d4c0060fb33823413a1249f9f364ad6e49e38ed4 Mon Sep 17 00:00:00 2001 From: Daniel Adam Date: Fri, 1 Mar 2024 12:50:01 +0100 Subject: [PATCH 2/5] Update docker images golang: 1.20.13-alpine -> 1.20.14-alpine --- cmd/bridge-device/Dockerfile | 2 +- test/cloud-server/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/bridge-device/Dockerfile b/cmd/bridge-device/Dockerfile index 4828f1a7..e910aeef 100644 --- a/cmd/bridge-device/Dockerfile +++ b/cmd/bridge-device/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM golang:1.20.13-alpine AS build +FROM golang:1.20.14-alpine AS build RUN apk add --no-cache curl git build-base WORKDIR $GOPATH/src/github.com/plgd-dev/device COPY go.mod go.sum ./ diff --git a/test/cloud-server/Dockerfile b/test/cloud-server/Dockerfile index da5f0077..98fcaa98 100644 --- a/test/cloud-server/Dockerfile +++ b/test/cloud-server/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.13-alpine AS build +FROM golang:1.20.14-alpine AS build RUN apk add --no-cache curl git build-base WORKDIR $GOPATH/src/github.com/plgd-dev/device COPY go.mod go.sum ./ From 1f9dc018a9a8a636aee23d1ba6b36f53bed591d6 Mon Sep 17 00:00:00 2001 From: Daniel Adam Date: Fri, 1 Mar 2024 12:51:17 +0100 Subject: [PATCH 3/5] Fix issues reported by SonarCloud --- test/cloud-server/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cloud-server/Dockerfile b/test/cloud-server/Dockerfile index 98fcaa98..59e6fbb2 100644 --- a/test/cloud-server/Dockerfile +++ b/test/cloud-server/Dockerfile @@ -8,7 +8,7 @@ RUN go test -c -coverpkg=./... -covermode=atomic ./client -o /go/bin/device.clie RUN go test -c -coverpkg=./... -covermode=atomic ./client/core -o /go/bin/device.client.core.test FROM alpine:3.19 AS service -RUN apk add bash +RUN apk add --no-cache bash COPY --from=build /go/bin/device.client.test /usr/local/bin/device.client.test COPY --from=build /go/bin/device.client.core.test /usr/local/bin/device.client.core.test COPY ./test/cloud-server/run.sh /usr/local/bin/run.sh From 110d313a6b83f8cbe5e7a8bfb840f96cba60095e Mon Sep 17 00:00:00 2001 From: Daniel Adam Date: Tue, 5 Mar 2024 08:04:27 +0100 Subject: [PATCH 4/5] SonarCloud: Add unit tests to increase code coverage --- .golangci.yml | 11 +- bridge/device/cloud/manager.go | 13 +- client/core/sdkError_test.go | 147 +++++++ client/options_internal_test.go | 395 ++++++++++++++++++ client/ownDevice.go | 3 - .../generateCertificate/config_test.go | 114 +++++ 6 files changed, 675 insertions(+), 8 deletions(-) create mode 100644 client/core/sdkError_test.go create mode 100644 client/options_internal_test.go create mode 100644 pkg/security/generateCertificate/config_test.go diff --git a/.golangci.yml b/.golangci.yml index bcade7e1..6f5190aa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,16 +1,19 @@ linters-settings: - gocyclo: - min-complexity: 15 - govet: - check-shadowing: true exhaustive: default-signifies-exhaustive: true + gocyclo: + min-complexity: 15 gomodguard: blocked: modules: - github.com/pkg/errors: recommendations: - errors + gomoddirectives: + replace-allow-list: + - github.com/pion/dtls/v2 + govet: + check-shadowing: true stylecheck: # STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks # Default: ["*"] diff --git a/bridge/device/cloud/manager.go b/bridge/device/cloud/manager.go index f749394c..ab4374c0 100644 --- a/bridge/device/cloud/manager.go +++ b/bridge/device/cloud/manager.go @@ -295,6 +295,17 @@ func (c *Manager) isCredsExpiring() bool { return !time.Now().Before(c.creds.ValidUntil.Add(-time.Second * 10)) } +func getResourceTypesFilter(request *mux.Message) []string { + queries, _ := request.Options().Queries() + resourceTypesFitler := []string{} + for _, q := range queries { + if len(q) > 3 && q[:3] == "rt=" { + resourceTypesFitler = append(resourceTypesFitler, q[3:]) + } + } + return resourceTypesFitler +} + func (c *Manager) serveCOAP(w mux.ResponseWriter, request *mux.Message) { request.Message.AddQuery("di=" + c.deviceID.String()) r := net.Request{ @@ -316,7 +327,7 @@ func (c *Manager) serveCOAP(w mux.ResponseWriter, request *mux.Message) { } resp, err = c.handler(&r) case plgdResources.ResourceURI: - links := c.getLinks(schema.Endpoints{}, c.deviceID, nil, resources.PublishToCloud) + links := c.getLinks(schema.Endpoints{}, c.deviceID, getResourceTypesFilter(request), resources.PublishToCloud) links = patchDeviceLink(links) links = discovery.PatchLinks(links, c.deviceID.String()) resp, err = resources.CreateResponseContent(request.Context(), links, codes.Content) diff --git a/client/core/sdkError_test.go b/client/core/sdkError_test.go new file mode 100644 index 00000000..8b7446d5 --- /dev/null +++ b/client/core/sdkError_test.go @@ -0,0 +1,147 @@ +// ************************************************************************ +// Copyright (C) 2024 plgd.dev, s.r.o. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ************************************************************************ + +package core_test + +import ( + "errors" + "testing" + + "github.com/plgd-dev/device/v2/client/core" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" +) + +var err = errors.New("test") + +func TestMakeCanceled(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeCanceled(err), &sdkErr)) + require.Equal(t, codes.Canceled, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeUnknown(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeUnknown(err), &sdkErr)) + require.Equal(t, codes.Unknown, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeInvalidArgument(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeInvalidArgument(err), &sdkErr)) + require.Equal(t, codes.InvalidArgument, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeDeadlineExceeded(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeDeadlineExceeded(err), &sdkErr)) + require.Equal(t, codes.DeadlineExceeded, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeNotFound(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeNotFound(err), &sdkErr)) + require.Equal(t, codes.NotFound, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeAlreadyExists(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeAlreadyExists(err), &sdkErr)) + require.Equal(t, codes.AlreadyExists, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakePermissionDenied(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakePermissionDenied(err), &sdkErr)) + require.Equal(t, codes.PermissionDenied, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeResourceExhausted(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeResourceExhausted(err), &sdkErr)) + require.Equal(t, codes.ResourceExhausted, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeFailedPrecondition(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeFailedPrecondition(err), &sdkErr)) + require.Equal(t, codes.FailedPrecondition, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeAborted(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeAborted(err), &sdkErr)) + require.Equal(t, codes.Aborted, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeOutOfRange(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeOutOfRange(err), &sdkErr)) + require.Equal(t, codes.OutOfRange, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeUnimplemented(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeUnimplemented(err), &sdkErr)) + require.Equal(t, codes.Unimplemented, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeInternal(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeInternal(err), &sdkErr)) + require.Equal(t, codes.Internal, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeInternalStr(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeInternalStr("test:%v", err), &sdkErr)) + require.Equal(t, codes.Internal, sdkErr.GetCode()) + require.Contains(t, sdkErr.Error(), "test:"+err.Error()) +} + +func TestMakeUnavailable(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeUnavailable(err), &sdkErr)) + require.Equal(t, codes.Unavailable, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeDataLoss(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeDataLoss(err), &sdkErr)) + require.Equal(t, codes.DataLoss, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} + +func TestMakeUnauthenticated(t *testing.T) { + sdkErr := core.SdkError{} + require.True(t, errors.As(core.MakeUnauthenticated(err), &sdkErr)) + require.Equal(t, codes.Unauthenticated, sdkErr.GetCode()) + require.Equal(t, err, sdkErr.Unwrap()) +} diff --git a/client/options_internal_test.go b/client/options_internal_test.go new file mode 100644 index 00000000..c93c7046 --- /dev/null +++ b/client/options_internal_test.go @@ -0,0 +1,395 @@ +// ************************************************************************ +// Copyright (C) 2024 plgd.dev, s.r.o. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ************************************************************************ + +package client + +import ( + "context" + "testing" + + "github.com/plgd-dev/device/v2/client/core" + "github.com/plgd-dev/device/v2/pkg/codec/ocf" + "github.com/plgd-dev/device/v2/pkg/net/coap" + "github.com/plgd-dev/device/v2/schema" + "github.com/plgd-dev/device/v2/schema/interfaces" + "github.com/plgd-dev/go-coap/v3/message" + "github.com/stretchr/testify/require" +) + +const ( + testIface = interfaces.OC_IF_BASELINE + testQuery = "uid=nick.smith" + testRt = "oic.test" +) + +func ifquery() string { + return "if=" + interfaces.OC_IF_BASELINE +} + +func rtquery() string { + return "rt=" + testRt +} + +func TestApplyOnCommonCommand(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + deviceID := "123" + opts := []CommonCommandOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithQuery(testQuery), + WithDeviceID(deviceID), + } + + var o commonCommandOptions + for _, opt := range opts { + o = opt.applyOnCommonCommand(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + queries, err := mopts.Queries() + require.NoError(t, err) + // WithQuery + require.Contains(t, queries, testQuery) + // WithDeviceID + require.Contains(t, queries, "di="+deviceID) +} + +func TestApplyOnGet(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + etag := "123" + codec := ocf.VNDOCFCBORCodec{} + opts := []GetOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithETag([]byte(etag)), + WithInterface(testIface), + WithQuery(testQuery), + WithResourceTypes(testRt), + WithCodec(codec), + } + + var o getOptions + for _, opt := range opts { + o = opt.applyOnGet(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + // WithCodec + require.Equal(t, codec, o.codec) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + // WithETag + require.True(t, mopts.HasOption(message.ETag)) + val, err := mopts.GetBytes(message.ETag) + require.NoError(t, err) + require.Equal(t, etag, string(val)) + queries, err := mopts.Queries() + require.NoError(t, err) + // WithInterface + require.Contains(t, queries, ifquery()) + // WithQuery + require.Contains(t, queries, testQuery) + // WithResourceTypes + require.Contains(t, queries, rtquery()) +} + +func TestApplyOnObserve(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + codec := ocf.VNDOCFCBORCodec{} + opts := []ObserveOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithInterface(testIface), + WithQuery(testQuery), + WithCodec(codec), + } + + var o observeOptions + for _, opt := range opts { + o = opt.applyOnObserve(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + // WithCodec + require.Equal(t, codec, o.codec) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + queries, err := mopts.Queries() + require.NoError(t, err) + // WithInterface + require.Contains(t, queries, ifquery()) + // WithQuery + require.Contains(t, queries, testQuery) +} + +func TestApplyOnUpdate(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + codec := ocf.VNDOCFCBORCodec{} + opts := []UpdateOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithInterface(testIface), + WithQuery(testQuery), + WithCodec(codec), + } + + var o updateOptions + for _, opt := range opts { + o = opt.applyOnUpdate(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + // WithCodec + require.Equal(t, codec, o.codec) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + queries, err := mopts.Queries() + require.NoError(t, err) + // WithInterface + require.Contains(t, queries, ifquery()) + // WithQuery + require.Contains(t, queries, testQuery) +} + +func TestApplyOnCreate(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + codec := ocf.VNDOCFCBORCodec{} + opts := []CreateOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithQuery(testQuery), + WithCodec(codec), + } + + var o createOptions + for _, opt := range opts { + o = opt.applyOnCreate(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + // WithCodec + require.Equal(t, codec, o.codec) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + queries, err := mopts.Queries() + require.NoError(t, err) + // WithQuery + require.Contains(t, queries, testQuery) +} + +func TestApplyOnDelete(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + codec := ocf.VNDOCFCBORCodec{} + opts := []DeleteOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithInterface(testIface), + WithQuery(testQuery), + WithCodec(codec), + } + + var o deleteOptions + for _, opt := range opts { + o = opt.applyOnDelete(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + // WithCodec + require.Equal(t, codec, o.codec) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + queries, err := mopts.Queries() + require.NoError(t, err) + // WithInterface + require.Contains(t, queries, ifquery()) + // WithQuery + require.Contains(t, queries, testQuery) +} + +func TestApplyOnOwn(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + psk := []byte("123") + onOwn := func(context.Context, *coap.ClientCloseHandler) (string, error) { + return "", nil + } + afterOwn := func(context.Context, *coap.ClientCloseHandler) error { + return nil + } + opts := []OwnOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithPresharedKey(psk), + WithActionDuringOwn(onOwn), + WithActionAfterOwn(afterOwn), + WithOTM(OTMType_Manufacturer), + WithOTMs([]OTMType{OTMType_JustWorks}), + } + + var o ownOptions + for _, opt := range opts { + o = opt.applyOnOwn(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) +} + +func TestApplyOnGetDevice(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + getDetails := func(context.Context, *core.Device, schema.ResourceLinks, ...func(message.Options) message.Options) (interface{}, error) { + return "", nil + } + opts := []GetDeviceOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithQuery(testQuery), + WithGetDetails(getDetails), + } + + var o getDeviceOptions + for _, opt := range opts { + o = opt.applyOnGetDevice(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + // WithGetDetails + require.NotNil(t, o.getDetails) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + queries, err := mopts.Queries() + require.NoError(t, err) + // WithQuery + require.Contains(t, queries, testQuery) +} + +func TestApplyOnGetDevices(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + getDetails := func(context.Context, *core.Device, schema.ResourceLinks, ...func(message.Options) message.Options) (interface{}, error) { + return "", nil + } + opts := []GetDevicesOption{ + WithDiscoveryConfiguration(discoveryCfg), + WithGetDetails(getDetails), + WithResourceTypes(testRt), + WithUseDeviceID(true), + } + + var o getDevicesOptions + for _, opt := range opts { + o = opt.applyOnGetDevices(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) + // WithGetDetails + require.NotNil(t, o.getDetails) + // WithResourceTypes + require.Contains(t, o.resourceTypes, testRt) + // WithUseDeviceID + require.True(t, o.useDeviceID) +} + +func TestApplyOnGetGetDevicesWithHandler(t *testing.T) { + discoveryCfg := core.DiscoveryConfiguration{ + MulticastHopLimit: 42, + } + opts := []GetDevicesWithHandlerOption{ + WithDiscoveryConfiguration(discoveryCfg), + } + + var o getDevicesWithHandlerOptions + for _, opt := range opts { + o = opt.applyOnGetGetDevicesWithHandler(o) + } + + // WithDiscoveryConfiguration + require.Equal(t, discoveryCfg, o.discoveryConfiguration) +} + +func TestApplyOnGetDeviceByIP(t *testing.T) { + getDetails := func(context.Context, *core.Device, schema.ResourceLinks, ...func(message.Options) message.Options) (interface{}, error) { + return "", nil + } + opts := []GetDeviceByIPOption{ + WithGetDetails(getDetails), + WithQuery(testQuery), + } + + var o getDeviceByIPOptions + for _, opt := range opts { + o = opt.applyOnGetDeviceByIP(o) + } + + // WithGetDetails + require.NotNil(t, o.getDetails) + + mopts := message.Options{} + for _, mopt := range o.opts { + mopts = mopt(mopts) + } + + queries, err := mopts.Queries() + require.NoError(t, err) + // WithQuery + require.Contains(t, queries, testQuery) +} diff --git a/client/ownDevice.go b/client/ownDevice.go index d3b6b0cb..abe1519a 100644 --- a/client/ownDevice.go +++ b/client/ownDevice.go @@ -38,9 +38,6 @@ func (c *Client) OwnDevice(ctx context.Context, deviceID string, opts ...OwnOpti return "", err } ok := d.IsSecured() - if err != nil { - return "", err - } if !ok { // don't own insecure device return deviceID, nil diff --git a/pkg/security/generateCertificate/config_test.go b/pkg/security/generateCertificate/config_test.go new file mode 100644 index 00000000..4a9124aa --- /dev/null +++ b/pkg/security/generateCertificate/config_test.go @@ -0,0 +1,114 @@ +package generateCertificate_test + +import ( + "crypto/x509" + "encoding/asn1" + "net" + "testing" + "time" + + "github.com/plgd-dev/device/v2/pkg/security/generateCertificate" + "github.com/stretchr/testify/require" +) + +func TestConfigToValidFrom(t *testing.T) { + cfg := generateCertificate.Configuration{} + _, err := cfg.ToValidFrom() + require.NoError(t, err) + + cfg.ValidFrom = "now" + _, err = cfg.ToValidFrom() + require.NoError(t, err) + + cfg.ValidFrom = "2021-01-01T00:00:00Z" + validFrom, err := cfg.ToValidFrom() + require.NoError(t, err) + vf, err := time.Parse(time.RFC3339, "2021-01-01T00:00:00Z") + require.NoError(t, err) + require.Equal(t, vf, validFrom) + + cfg.ValidFrom = "invalid" + _, err = cfg.ToValidFrom() + require.Error(t, err) +} + +func TestX509KeyUsages(t *testing.T) { + cfg := generateCertificate.Configuration{} + cfg.KeyUsages = []string{""} + _, err := cfg.X509KeyUsages() + require.NoError(t, err) + + cfg.KeyUsages = []string{"invalid"} + _, err = cfg.X509KeyUsages() + require.Error(t, err) + + cfg.KeyUsages = []string{"digitalSignature", "contentCommitment", "keyEncipherment", "dataEncipherment", "keyAgreement", "certSign", "crlSign", "encipherOnly", "decipherOnly"} + ku, err := cfg.X509KeyUsages() + require.NoError(t, err) + require.True(t, (ku&x509.KeyUsageDigitalSignature) != 0) + require.True(t, (ku&x509.KeyUsageContentCommitment) != 0) + require.True(t, (ku&x509.KeyUsageKeyEncipherment) != 0) + require.True(t, (ku&x509.KeyUsageDataEncipherment) != 0) + require.True(t, (ku&x509.KeyUsageKeyAgreement) != 0) + require.True(t, (ku&x509.KeyUsageCertSign) != 0) + require.True(t, (ku&x509.KeyUsageCRLSign) != 0) + require.True(t, (ku&x509.KeyUsageEncipherOnly) != 0) + require.True(t, (ku&x509.KeyUsageDecipherOnly) != 0) +} + +func TestX509ExtKeyUsages(t *testing.T) { + cfg := generateCertificate.Configuration{ + ExtensionKeyUsages: []string{"invalid"}, + } + _, _, err := cfg.X509ExtKeyUsages() + require.Error(t, err) + + cfg = generateCertificate.Configuration{ + ExtensionKeyUsages: []string{""}, + } + ekus, unknownEkus, err := cfg.X509ExtKeyUsages() + require.NoError(t, err) + require.Nil(t, ekus) + require.Empty(t, unknownEkus) + + cfg = generateCertificate.Configuration{ + ExtensionKeyUsages: []string{"server", "client", "1.2.3.4.5"}, + } + + ekus, unknownEkus, err = cfg.X509ExtKeyUsages() + require.NoError(t, err) + require.Equal(t, []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, ekus) + expectedUnknownEkus := []asn1.ObjectIdentifier{{1, 2, 3, 4, 5}} + require.Equal(t, expectedUnknownEkus, unknownEkus) +} + +func TestAsnExtensionKeyUsages(t *testing.T) { + cfg := generateCertificate.Configuration{ + ExtensionKeyUsages: []string{"invalid"}, + } + _, err := cfg.AsnExtensionKeyUsages() + require.Error(t, err) + + cfg = generateCertificate.Configuration{ + ExtensionKeyUsages: []string{"server", "client", "1.2.3.4.5"}, + } + + ekus, err := cfg.AsnExtensionKeyUsages() + require.NoError(t, err) + expected := []asn1.ObjectIdentifier{{1, 3, 6, 1, 5, 5, 7, 3, 1}, {1, 3, 6, 1, 5, 5, 7, 3, 2}, {1, 2, 3, 4, 5}} + require.Equal(t, expected, ekus) +} + +func TestToIPAddresses(t *testing.T) { + cfg := generateCertificate.Configuration{} + cfg.SubjectAlternativeName.IPAddresses = []string{"not an IP address"} + _, err := cfg.ToIPAddresses() + require.Error(t, err) + + cfg = generateCertificate.Configuration{} + cfg.SubjectAlternativeName.IPAddresses = []string{"192.168.0.1", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"} + ips, err := cfg.ToIPAddresses() + require.NoError(t, err) + expected := []net.IP{net.ParseIP("192.168.0.1"), net.ParseIP("2001:0db8:85a3:0000:0000:8a2e:0370:7334")} + require.Equal(t, expected, ips) +} From 1b20de4ad6da0fd42163ac8e969cc57062ae54b9 Mon Sep 17 00:00:00 2001 From: Daniel Adam Date: Tue, 5 Mar 2024 08:04:50 +0100 Subject: [PATCH 5/5] Upgrade dependencies Direct: github.com/fxamacker/cbor/v2 v2.6.0 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/plgd-dev/go-coap/v3 v3.3.4-0.20240303135359-ce5dcc5ef1ba github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.62.0 Indirect: golang.org/x/crypto v0.21.0 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 golang.org/x/net v0.22.0 golang.org/x/sys v0.18.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 --- go.mod | 25 +++++++++++++------------ go.sum | 49 ++++++++++++++++++++----------------------------- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/go.mod b/go.mod index a46dd897..44981a41 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/plgd-dev/device/v2 go 1.20 require ( - github.com/fxamacker/cbor/v2 v2.5.0 - github.com/golang-jwt/jwt/v5 v5.2.0 + github.com/fxamacker/cbor/v2 v2.6.0 + github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/uuid v1.6.0 github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1 github.com/hashicorp/go-multierror v1.1.1 @@ -12,13 +12,13 @@ require ( github.com/karrick/tparse/v2 v2.8.2 github.com/pion/dtls/v2 v2.2.8-0.20240201071732-2597464081c8 github.com/pion/logging v0.2.2 - github.com/plgd-dev/go-coap/v3 v3.3.2-0.20240201130556-f8d6fade418f + github.com/plgd-dev/go-coap/v3 v3.3.4-0.20240303135359-ce5dcc5ef1ba github.com/plgd-dev/kit/v2 v2.0.0-20211006190727-057b33161b90 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 github.com/ugorji/go/codec v1.2.12 go.uber.org/atomic v1.11.0 golang.org/x/sync v0.6.0 - google.golang.org/grpc v1.61.0 + google.golang.org/grpc v1.62.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -31,13 +31,14 @@ require ( github.com/pion/transport/v3 v3.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/x448/float16 v0.8.4 // indirect - golang.org/x/crypto v0.18.0 // indirect - golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect - golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 // indirect google.golang.org/protobuf v1.32.0 // indirect ) -// note: github.com/pion/dtls/v2/pkg/net package is not yet available in release branches -exclude github.com/pion/dtls/v2 v2.2.9 +// note: github.com/pion/dtls/v2/pkg/net package is not yet available in release branches, +// so we force to the use of the pinned master branch +replace github.com/pion/dtls/v2 => github.com/pion/dtls/v2 v2.2.8-0.20240201071732-2597464081c8 diff --git a/go.sum b/go.sum index 3a1984a9..f9d73fbc 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fxamacker/cbor/v2 v2.2.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= -github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= -github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= +github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA= +github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-acme/lego v2.7.2+incompatible/go.mod h1:yzMNe9CasVUhkquNvti5nAtPmG94USbYxYrZfTkIn0M= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= @@ -31,8 +31,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= -github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -90,24 +90,18 @@ github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7 github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/panjf2000/ants/v2 v2.4.3/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pion/dtls/v2 v2.0.1-0.20200503085337-8e86b3a7d585/go.mod h1:/GahSOC8ZY/+17zkaGJIG4OUkSGAcZu/N/g3roBOCkM= -github.com/pion/dtls/v2 v2.0.10-0.20210502094952-3dc563b9aede/go.mod h1:86wv5dgx2J/z871nUR+5fTTY9tISLUlo+C5Gm86r1Hs= github.com/pion/dtls/v2 v2.2.8-0.20240201071732-2597464081c8 h1:r7K+oQUYubeA0am08kTAvd2wT2D8PZggs/CpMGp0nkM= github.com/pion/dtls/v2 v2.2.8-0.20240201071732-2597464081c8/go.mod h1:/gft3czh67pwl4nM1BBUvF7eTy72uGkObJXOYfxRDbA= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= -github.com/pion/transport v0.10.0/go.mod h1:BnHnUipd0rZQyTVB2SBGojFHT9CBt5C5TcsJSQGkvSE= -github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q= -github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A= github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM= github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= -github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/plgd-dev/go-coap/v2 v2.0.4-0.20200819112225-8eb712b901bc/go.mod h1:+tCi9Q78H/orWRtpVWyBgrr4vKFo2zYtbbxUllerBp4= github.com/plgd-dev/go-coap/v2 v2.4.1-0.20210517130748-95c37ac8e1fa/go.mod h1:rA7fc7ar+B/qa+Q0hRqv7yj/EMtIlmo1l7vkQGSrHPU= -github.com/plgd-dev/go-coap/v3 v3.3.2-0.20240201130556-f8d6fade418f h1:pVQdfS93HKSqHMNIH4JJcz2lUl/mgoZ6FOjQQDcTPMM= -github.com/plgd-dev/go-coap/v3 v3.3.2-0.20240201130556-f8d6fade418f/go.mod h1:Pac6EsvakCrwCaZGk7YkbecVLnDYRauEt4ULvYRw5Dk= +github.com/plgd-dev/go-coap/v3 v3.3.4-0.20240303135359-ce5dcc5ef1ba h1:bDpB1PPdUzgaTdcPr4jMdbb78ODxvG9CE7lSOQngL9Y= +github.com/plgd-dev/go-coap/v3 v3.3.4-0.20240303135359-ce5dcc5ef1ba/go.mod h1:rUgy/k2SX0esIM7JT01euQALT5YrYkROwxMSwfiIzhw= github.com/plgd-dev/kit v0.0.0-20200819113605-d5fcf3e94f63/go.mod h1:Yl9zisyXfPdtP9hTWlJqjJYXmgU/jtSDKttz9/CeD90= github.com/plgd-dev/kit/v2 v2.0.0-20211006190727-057b33161b90 h1:TC1HJ/UbyflJFPvaOdGmNZ5TeFGex1/dyr9urNGLy7M= github.com/plgd-dev/kit/v2 v2.0.0-20211006190727-057b33161b90/go.mod h1:Z7oKFLSGQjdi8eInxwFCs0tSApuEM1o0qNck+sJYp4M= @@ -124,12 +118,12 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf 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= 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/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= @@ -153,17 +147,16 @@ go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= 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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= -golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -185,16 +178,15 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210502030024-e5908800b52b/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -213,7 +205,6 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -223,8 +214,9 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -258,21 +250,20 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 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= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 h1:IR+hp6ypxjH24bkMfEJ0yHR21+gwPWdV+/IBrPQyn3k= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= +google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=