Browse Source

Revert "fix: keepersecurity support for shortcuts (#4825)" (#4870)

This reverts commit d6ecbf4db81ead47aa8fbe412a94f69d2a9941da.

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
Gergely Brautigam 10 months ago
parent
commit
5d2bb437e7
1 changed files with 8 additions and 1 deletions
  1. 8 1
      pkg/provider/keepersecurity/client.go

+ 8 - 1
pkg/provider/keepersecurity/client.go

@@ -32,6 +32,7 @@ import (
 const (
 	errKeeperSecuritySecretsNotFound            = "unable to find secrets. %w"
 	errKeeperSecuritySecretNotFound             = "unable to find secret %s. Error: %w"
+	errKeeperSecuritySecretNotUnique            = "more than 1 secret %s found"
 	errKeeperSecurityNoSecretsFound             = "no secrets found"
 	errKeeperSecurityInvalidSecretInvalidFormat = "invalid secret. Invalid format: %w"
 	errKeeperSecurityInvalidSecretDuplicatedKey = "invalid Secret. Following keys are duplicated %s"
@@ -314,6 +315,9 @@ func (c *Client) findSecretByID(id string) (*ksm.Record, error) {
 	if len(records) == 0 {
 		return nil, errors.New(errKeeperSecurityNoSecretsFound)
 	}
+	if len(records) > 1 {
+		return nil, fmt.Errorf(errKeeperSecuritySecretNotUnique, id)
+	}
 
 	return records[0], nil
 }
@@ -339,9 +343,12 @@ func (c *Client) findSecretByName(name string) (*ksm.Record, error) {
 	// DeleteSecret will consider record already deleted (no error)
 	if len(records) == 0 {
 		return nil, nil
+	} else if len(records) == 1 {
+		return records[0], nil
 	}
 
-	return records[0], nil
+	// len(records) > 1
+	return nil, fmt.Errorf(errKeeperSecuritySecretNotUnique, name)
 }
 
 func (s *Secret) validate() error {