From d14ff121fb50ebe189320c30866a61aa7a3c0cb9 Mon Sep 17 00:00:00 2001 From: khanhtc1202 Date: Wed, 15 Jun 2022 13:12:21 +0700 Subject: [PATCH] Remove KeyHash from piped model --- pkg/datastore/pipedstore_test.go | 1 - pkg/model/piped.go | 13 --- pkg/model/piped.pb.go | 151 +++++++++++++--------------- pkg/model/piped.pb.validate.go | 2 - pkg/model/piped.proto | 5 +- pkg/model/piped_test.go | 14 +-- web/model/piped_pb.d.ts | 4 - web/model/piped_pb.js | 30 ------ web/src/__fixtures__/dummy-piped.ts | 1 - 9 files changed, 72 insertions(+), 149 deletions(-) diff --git a/pkg/datastore/pipedstore_test.go b/pkg/datastore/pipedstore_test.go index ecf73a1f3e..a6a5ee81bd 100644 --- a/pkg/datastore/pipedstore_test.go +++ b/pkg/datastore/pipedstore_test.go @@ -46,7 +46,6 @@ func TestAddPiped(t *testing.T) { piped: &model.Piped{ Id: "id", Name: "name", - KeyHash: "key-hash", ProjectId: "project-id", CreatedAt: 1, UpdatedAt: 1, diff --git a/pkg/model/piped.go b/pkg/model/piped.go index ccd2ac98ec..f103324416 100644 --- a/pkg/model/piped.go +++ b/pkg/model/piped.go @@ -58,15 +58,6 @@ func GeneratePipedKey() (key, hash string, err error) { // CheckKey checks if the give key is one of the stored keys. func (p *Piped) CheckKey(key string) (err error) { - // The KeyHash field was deprecated. - // And this block will be removed in the future. - if p.KeyHash != "" { - err = bcrypt.CompareHashAndPassword([]byte(p.KeyHash), []byte(key)) - if err == nil { - return nil - } - } - if len(p.Keys) == 0 { return errors.New("piped does not contain any key") } @@ -104,9 +95,6 @@ func (p *Piped) AddKey(hash, creator string, createdAt time.Time) error { // DeleteOldPipedKeys removes all old keys to keep only the latest one. func (p *Piped) DeleteOldPipedKeys() { - // This field was deprecated so we reset it too. - p.KeyHash = "" - if len(p.Keys) < 2 { return } @@ -121,7 +109,6 @@ func (p *Piped) DeleteOldPipedKeys() { } func (p *Piped) RedactSensitiveData() { - p.KeyHash = redactedMessage for i := range p.Keys { p.Keys[i].Hash = redactedMessage } diff --git a/pkg/model/piped.pb.go b/pkg/model/piped.pb.go index 4d603b152a..07886061c6 100644 --- a/pkg/model/piped.pb.go +++ b/pkg/model/piped.pb.go @@ -95,11 +95,6 @@ type Piped struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // The additional description about the piped. Desc string `protobuf:"bytes,3,opt,name=desc,proto3" json:"desc,omitempty"` - // The hash value of the secret key generated for the piped. - // This is used to authenticate while communicating with the control plane. - // - // Deprecated: Do not use. - KeyHash string `protobuf:"bytes,4,opt,name=key_hash,json=keyHash,proto3" json:"key_hash,omitempty"` // The ID of the project this piped belongs to. ProjectId string `protobuf:"bytes,5,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` // Currently running version. @@ -183,14 +178,6 @@ func (x *Piped) GetDesc() string { return "" } -// Deprecated: Do not use. -func (x *Piped) GetKeyHash() string { - if x != nil { - return x.KeyHash - } - return "" -} - func (x *Piped) GetProjectId() string { if x != nil { return x.ProjectId @@ -474,80 +461,78 @@ var file_pkg_model_piped_proto_rawDesc = []byte{ 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xee, 0x07, 0x0a, 0x05, 0x50, 0x69, 0x70, 0x65, 0x64, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0xd5, 0x07, 0x0a, 0x05, 0x50, 0x69, 0x70, 0x65, 0x64, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, - 0x65, 0x73, 0x63, 0x12, 0x1d, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x48, 0x61, - 0x73, 0x68, 0x12, 0x26, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, - 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, - 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, - 0x64, 0x41, 0x74, 0x12, 0x43, 0x0a, 0x0f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x70, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x12, 0x43, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x47, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, - 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3f, 0x0a, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x08, 0xfa, 0x42, - 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, - 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4a, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x5f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x15, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, 0x2e, - 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x10, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, 0x4b, 0x65, - 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x73, 0x69, 0x72, - 0x65, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x0a, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x41, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x61, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, - 0x00, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x1a, 0x49, 0x0a, 0x0d, - 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1b, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0xa6, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xfa, 0x42, 0x24, 0x72, - 0x22, 0x52, 0x08, 0x4b, 0x45, 0x59, 0x5f, 0x50, 0x41, 0x49, 0x52, 0x52, 0x07, 0x47, 0x43, 0x50, - 0x5f, 0x4b, 0x4d, 0x53, 0x52, 0x07, 0x41, 0x57, 0x53, 0x5f, 0x4b, 0x4d, 0x53, 0x52, 0x04, 0x4e, - 0x4f, 0x4e, 0x45, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x17, 0x65, 0x6e, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x65, 0x6e, 0x63, 0x72, 0x79, - 0x70, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x38, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, - 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, - 0x22, 0x72, 0x0a, 0x08, 0x50, 0x69, 0x70, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x04, - 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x07, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, - 0x02, 0x10, 0x01, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x26, 0x0a, 0x0a, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x41, 0x74, 0x42, 0x25, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x2d, 0x63, 0x64, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x63, - 0x64, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x63, 0x12, 0x26, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x43, 0x0a, 0x0f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, 0x2e, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x12, 0x43, 0x0a, 0x0c, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x47, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3f, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, 0x2e, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x08, 0xfa, + 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4a, 0x0a, 0x11, 0x73, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x5f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x15, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, + 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x10, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x69, 0x70, 0x65, 0x64, 0x4b, + 0x65, 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x73, 0x69, + 0x72, 0x65, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x26, 0x0a, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, + 0x20, 0x00, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x1a, 0x49, 0x0a, + 0x0d, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1b, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0xa6, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xfa, 0x42, 0x24, + 0x72, 0x22, 0x52, 0x08, 0x4b, 0x45, 0x59, 0x5f, 0x50, 0x41, 0x49, 0x52, 0x52, 0x07, 0x47, 0x43, + 0x50, 0x5f, 0x4b, 0x4d, 0x53, 0x52, 0x07, 0x41, 0x57, 0x53, 0x5f, 0x4b, 0x4d, 0x53, 0x52, 0x04, + 0x4e, 0x4f, 0x4e, 0x45, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x17, 0x65, 0x6e, 0x63, + 0x72, 0x79, 0x70, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x65, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x38, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, + 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, + 0x05, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x22, 0x72, 0x0a, 0x08, 0x50, 0x69, 0x70, 0x65, 0x64, + 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, + 0x12, 0x21, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x6f, 0x72, 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, + 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x25, 0x5a, 0x23, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x2d, 0x63, + 0x64, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x63, 0x64, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/model/piped.pb.validate.go b/pkg/model/piped.pb.validate.go index 216df5de2c..69151ba6e6 100644 --- a/pkg/model/piped.pb.validate.go +++ b/pkg/model/piped.pb.validate.go @@ -80,8 +80,6 @@ func (m *Piped) validate(all bool) error { // no validation rules for Desc - // no validation rules for KeyHash - if utf8.RuneCountInString(m.GetProjectId()) < 1 { err := PipedValidationError{ field: "ProjectId", diff --git a/pkg/model/piped.proto b/pkg/model/piped.proto index a44846c6ac..dc6b9b028f 100644 --- a/pkg/model/piped.proto +++ b/pkg/model/piped.proto @@ -21,7 +21,7 @@ import "validate/validate.proto"; import "pkg/model/common.proto"; message Piped { - reserved 6; + reserved 4, 6; message CloudProvider { string name = 1 [(validate.rules).string.min_len = 1]; @@ -46,9 +46,6 @@ message Piped { string name = 2 [(validate.rules).string.min_len = 1]; // The additional description about the piped. string desc = 3; - // The hash value of the secret key generated for the piped. - // This is used to authenticate while communicating with the control plane. - string key_hash = 4 [deprecated=true]; // The ID of the project this piped belongs to. string project_id = 5 [(validate.rules).string.min_len = 1]; diff --git a/pkg/model/piped_test.go b/pkg/model/piped_test.go index de731fe04c..f420a92d57 100644 --- a/pkg/model/piped_test.go +++ b/pkg/model/piped_test.go @@ -104,18 +104,15 @@ func TestPipedDeleteOldPipedKeys(t *testing.T) { { name: "no key", piped: Piped{ - KeyHash: "hash-key", - Keys: []*PipedKey{}, + Keys: []*PipedKey{}, }, expected: Piped{ - KeyHash: "", - Keys: []*PipedKey{}, + Keys: []*PipedKey{}, }, }, { name: "has 1 key", piped: Piped{ - KeyHash: "hash-key", Keys: []*PipedKey{ { Hash: "hash-1", @@ -125,7 +122,6 @@ func TestPipedDeleteOldPipedKeys(t *testing.T) { }, }, expected: Piped{ - KeyHash: "", Keys: []*PipedKey{ { Hash: "hash-1", @@ -138,7 +134,6 @@ func TestPipedDeleteOldPipedKeys(t *testing.T) { { name: "has multiple keys", piped: Piped{ - KeyHash: "hash-key", Keys: []*PipedKey{ { Hash: "hash-1", @@ -158,7 +153,6 @@ func TestPipedDeleteOldPipedKeys(t *testing.T) { }, }, expected: Piped{ - KeyHash: "", Keys: []*PipedKey{ { Hash: "hash-3", @@ -185,9 +179,8 @@ func TestPipedRedactSensitiveData(t *testing.T) { expected Piped }{ { - name: "contains both KeyHash and Keys", + name: "contains multiple Keys", piped: Piped{ - KeyHash: "hash-key", Keys: []*PipedKey{ { Hash: "hash-1", @@ -207,7 +200,6 @@ func TestPipedRedactSensitiveData(t *testing.T) { }, }, expected: Piped{ - KeyHash: "redacted", Keys: []*PipedKey{ { Hash: "redacted", diff --git a/web/model/piped_pb.d.ts b/web/model/piped_pb.d.ts index 25b902ac68..5572c91481 100644 --- a/web/model/piped_pb.d.ts +++ b/web/model/piped_pb.d.ts @@ -14,9 +14,6 @@ export class Piped extends jspb.Message { getDesc(): string; setDesc(value: string): Piped; - getKeyHash(): string; - setKeyHash(value: string): Piped; - getProjectId(): string; setProjectId(value: string): Piped; @@ -77,7 +74,6 @@ export namespace Piped { id: string, name: string, desc: string, - keyHash: string, projectId: string, version: string, startedAt: number, diff --git a/web/model/piped_pb.js b/web/model/piped_pb.js index 677701da25..7958848fbd 100644 --- a/web/model/piped_pb.js +++ b/web/model/piped_pb.js @@ -156,7 +156,6 @@ proto.model.Piped.toObject = function(includeInstance, msg) { id: jspb.Message.getFieldWithDefault(msg, 1, ""), name: jspb.Message.getFieldWithDefault(msg, 2, ""), desc: jspb.Message.getFieldWithDefault(msg, 3, ""), - keyHash: jspb.Message.getFieldWithDefault(msg, 4, ""), projectId: jspb.Message.getFieldWithDefault(msg, 5, ""), version: jspb.Message.getFieldWithDefault(msg, 7, ""), startedAt: jspb.Message.getFieldWithDefault(msg, 8, 0), @@ -221,10 +220,6 @@ proto.model.Piped.deserializeBinaryFromReader = function(msg, reader) { var value = /** @type {string} */ (reader.readString()); msg.setDesc(value); break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setKeyHash(value); - break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setProjectId(value); @@ -331,13 +326,6 @@ proto.model.Piped.serializeBinaryToWriter = function(message, writer) { f ); } - f = message.getKeyHash(); - if (f.length > 0) { - writer.writeString( - 4, - f - ); - } f = message.getProjectId(); if (f.length > 0) { writer.writeString( @@ -849,24 +837,6 @@ proto.model.Piped.prototype.setDesc = function(value) { }; -/** - * optional string key_hash = 4; - * @return {string} - */ -proto.model.Piped.prototype.getKeyHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * @param {string} value - * @return {!proto.model.Piped} returns this - */ -proto.model.Piped.prototype.setKeyHash = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); -}; - - /** * optional string project_id = 5; * @return {string} diff --git a/web/src/__fixtures__/dummy-piped.ts b/web/src/__fixtures__/dummy-piped.ts index 6161741885..88df1b5053 100644 --- a/web/src/__fixtures__/dummy-piped.ts +++ b/web/src/__fixtures__/dummy-piped.ts @@ -29,7 +29,6 @@ export const dummyPiped: Piped.AsObject = { desiredVersion: "v1.0.0", status: Piped.ConnectionStatus.ONLINE, config: "apiVersion: pipecd.dev/v1beta1", - keyHash: "12345", keysList: [ { hash: "key-1", creator: "user", createdAt: createdAt.unix() }, { hash: "key-2", creator: "user", createdAt: createdAt.unix() },