diff --git a/plugin/state.go b/plugin/state.go index e5a0c7c..982abef 100644 --- a/plugin/state.go +++ b/plugin/state.go @@ -100,29 +100,20 @@ func awsCatalogPersistedStateFromProto(in *pb.HostCatalogPersisted, opts ...awsC return nil, errors.New("missing persisted secrets") } - unknownFields := structFields(data) - accessKeyId, err := getStringValue(data, constAccessKeyId, true) if err != nil { return nil, fmt.Errorf("persisted state integrity error: %w", err) } - delete(unknownFields, constAccessKeyId) secretAccessKey, err := getStringValue(data, constSecretAccessKey, true) if err != nil { return nil, fmt.Errorf("persisted state integrity error: %w", err) } - delete(unknownFields, constSecretAccessKey) credsLastRotatedTime, err := getTimeValue(data, constCredsLastRotatedTime) if err != nil { return nil, fmt.Errorf("persisted state integrity error: %w", err) } - delete(unknownFields, constCredsLastRotatedTime) - - if len(unknownFields) != 0 { - return nil, errors.New("one or more unrecognized persisted secret attributes found") - } s, err := newAwsCatalogPersistedState(opts...) if err != nil { diff --git a/plugin/state_test.go b/plugin/state_test.go index 9a6c3d1..fb94500 100644 --- a/plugin/state_test.go +++ b/plugin/state_test.go @@ -168,20 +168,6 @@ func TestAwsCatalogPersistedStateFromProto(t *testing.T) { }, expectedErr: testOptionErr, }, - { - name: "unknown fields", - in: &pb.HostCatalogPersisted{ - // Nil should be the same as empty map here - Secrets: mustStruct(map[string]interface{}{ - constAccessKeyId: "foobar", - constSecretAccessKey: "bazqux", - constCredsLastRotatedTime: (time.Time{}).Format(time.RFC3339Nano), - "foo": true, - "bar": true, - }), - }, - expectedErr: "one or more unrecognized persisted secret attributes found", - }, { name: "good with non-zero timestamp", in: &pb.HostCatalogPersisted{