Skip to content

Commit 6d00ba8

Browse files
authored
do not error during bootstrap if license signature is valid but fields have changed in the wrapper (#354)
instead log the error, and continue startup using the signed contents
1 parent ea88f7d commit 6d00ba8

File tree

5 files changed

+106
-43
lines changed

5 files changed

+106
-43
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/pact-foundation/pact-go v1.10.0
1212
github.com/pkg/errors v0.9.1
1313
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
14-
github.com/replicatedhq/kotskinds v0.0.0-20251125171126-af5844407f2a
14+
github.com/replicatedhq/kotskinds v0.0.0-20251202215158-294aceff2380
1515
github.com/robfig/cron/v3 v3.0.1
1616
github.com/spf13/cobra v1.10.1
1717
github.com/spf13/pflag v1.0.10

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ github.com/replicatedhq/kotskinds v0.0.0-20251125152515-acc84923a4f5 h1:NaLh1hQb
328328
github.com/replicatedhq/kotskinds v0.0.0-20251125152515-acc84923a4f5/go.mod h1:+k4PHo2wukoU9kdiKrqqgi89Wmj+9AiwppYGVK11zig=
329329
github.com/replicatedhq/kotskinds v0.0.0-20251125171126-af5844407f2a h1:E+Zv8NjHUvPprNyLuAUKoXApE7u/LmzeGAPAC4cA/XU=
330330
github.com/replicatedhq/kotskinds v0.0.0-20251125171126-af5844407f2a/go.mod h1:hpR1pZ3mEtbMrl/tmuqNjK+cSBcmb8F7A1EPhXwssfI=
331+
github.com/replicatedhq/kotskinds v0.0.0-20251202180751-4690bab843ec h1:GwZCFCu3Vkjx9SKRybZ3RAYHhOIYQuDwEyeJl7fe/2Y=
332+
github.com/replicatedhq/kotskinds v0.0.0-20251202180751-4690bab843ec/go.mod h1:hpR1pZ3mEtbMrl/tmuqNjK+cSBcmb8F7A1EPhXwssfI=
333+
github.com/replicatedhq/kotskinds v0.0.0-20251202215158-294aceff2380 h1:c5hnM6zpxVYZk/wCzGKsbABiBVpFHqQ08T5RXP7wLHQ=
334+
github.com/replicatedhq/kotskinds v0.0.0-20251202215158-294aceff2380/go.mod h1:hpR1pZ3mEtbMrl/tmuqNjK+cSBcmb8F7A1EPhXwssfI=
331335
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
332336
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
333337
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=

pkg/apiserver/bootstrap.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/cenkalti/backoff/v4"
77
"github.com/pkg/errors"
88
licensewrapper "github.com/replicatedhq/kotskinds/pkg/licensewrapper"
9+
licensewrappertypes "github.com/replicatedhq/kotskinds/pkg/licensewrapper/types"
910
"github.com/replicatedhq/replicated-sdk/pkg/appstate"
1011
appstatetypes "github.com/replicatedhq/replicated-sdk/pkg/appstate/types"
1112
"github.com/replicatedhq/replicated-sdk/pkg/heartbeat"
@@ -74,10 +75,17 @@ func bootstrap(params APIServerParams) error {
7475
unverifiedWrapper = wrapper
7576
}
7677

77-
verifiedWrapper, err := sdklicense.VerifySignature(unverifiedWrapper)
78+
err = unverifiedWrapper.VerifySignature()
7879
if err != nil {
79-
return backoff.Permanent(errors.Wrap(err, "failed to verify license signature"))
80+
if licensewrappertypes.IsLicenseDataValidationError(err) {
81+
// this is not a fatal error, it means that the license data outside of the signature was changed
82+
// however, the data inside the signature was still valid, and so the license has been updated to use that data instead
83+
log.Println(err.Error())
84+
} else {
85+
return backoff.Permanent(errors.Wrap(err, "failed to verify license signature"))
86+
}
8087
}
88+
verifiedWrapper := unverifiedWrapper
8189

8290
if !util.IsAirgap() {
8391
// sync license

pkg/license/signature.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)