mirror of
https://github.com/cloudflare/redoctober.git
synced 2026-05-28 10:40:49 +00:00
GetOwners returns labels on the encryption too
This commit is contained in:
12
core/core.go
12
core/core.go
@@ -172,6 +172,7 @@ type DecryptWithDelegates struct {
|
||||
type OwnersData struct {
|
||||
Status string
|
||||
Owners []string
|
||||
Labels []string
|
||||
Predicate string
|
||||
}
|
||||
|
||||
@@ -774,12 +775,17 @@ func Owners(jsonIn []byte) ([]byte, error) {
|
||||
return jsonStatusError(err)
|
||||
}
|
||||
|
||||
names, predicate, err := crypt.GetOwners(s.Data)
|
||||
names, labels, predicate, err := crypt.GetOwners(s.Data)
|
||||
if err != nil {
|
||||
return jsonStatusError(err)
|
||||
}
|
||||
|
||||
return json.Marshal(OwnersData{Status: "ok", Owners: names, Predicate: predicate})
|
||||
return json.Marshal(OwnersData{
|
||||
Status: "ok",
|
||||
Owners: names,
|
||||
Predicate: predicate,
|
||||
Labels: labels,
|
||||
})
|
||||
}
|
||||
|
||||
// Export returns a backed up vault.
|
||||
@@ -834,7 +840,7 @@ func Order(jsonIn []byte) (out []byte, err error) {
|
||||
}
|
||||
|
||||
// Get the owners of the ciphertext.
|
||||
owners, _, err := crypt.GetOwners(o.EncryptedData)
|
||||
owners, _, _, err := crypt.GetOwners(o.EncryptedData)
|
||||
if err != nil {
|
||||
return jsonStatusError(err)
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ func (c *Cryptor) decrypt(cache *keycache.Cache, in []byte, user string) (resp [
|
||||
|
||||
// GetOwners returns the list of users that can delegate their passwords
|
||||
// to decrypt the given encrypted secret.
|
||||
func (c *Cryptor) GetOwners(in []byte) (names []string, predicate string, err error) {
|
||||
func (c *Cryptor) GetOwners(in []byte) (names, labels []string, predicate string, err error) {
|
||||
// unwrap encrypted file
|
||||
var encrypted EncryptedData
|
||||
if err = json.Unmarshal(in, &encrypted); err != nil {
|
||||
@@ -661,6 +661,7 @@ func (c *Cryptor) GetOwners(in []byte) (names []string, predicate string, err er
|
||||
}
|
||||
}
|
||||
predicate = encrypted.Predicate
|
||||
labels = encrypted.Labels
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user