Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/datastore/pipedstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 0 additions & 13 deletions pkg/model/piped.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
151 changes: 68 additions & 83 deletions pkg/model/piped.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pkg/model/piped.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions pkg/model/piped.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];

Expand Down
14 changes: 3 additions & 11 deletions pkg/model/piped_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -125,7 +122,6 @@ func TestPipedDeleteOldPipedKeys(t *testing.T) {
},
},
expected: Piped{
KeyHash: "",
Keys: []*PipedKey{
{
Hash: "hash-1",
Expand All @@ -138,7 +134,6 @@ func TestPipedDeleteOldPipedKeys(t *testing.T) {
{
name: "has multiple keys",
piped: Piped{
KeyHash: "hash-key",
Keys: []*PipedKey{
{
Hash: "hash-1",
Expand All @@ -158,7 +153,6 @@ func TestPipedDeleteOldPipedKeys(t *testing.T) {
},
},
expected: Piped{
KeyHash: "",
Keys: []*PipedKey{
{
Hash: "hash-3",
Expand All @@ -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",
Expand All @@ -207,7 +200,6 @@ func TestPipedRedactSensitiveData(t *testing.T) {
},
},
expected: Piped{
KeyHash: "redacted",
Keys: []*PipedKey{
{
Hash: "redacted",
Expand Down
4 changes: 0 additions & 4 deletions web/model/piped_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -77,7 +74,6 @@ export namespace Piped {
id: string,
name: string,
desc: string,
keyHash: string,
projectId: string,
version: string,
startedAt: number,
Expand Down
Loading