Skip to content

Commit

Permalink
fix listing with encrypted paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mobyvb committed Oct 11, 2018
1 parent 51daf31 commit 50a20cc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/storage/streams/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,18 @@ func (s *streamStore) List(ctx context.Context, prefix, startAfter, endBefore pa
if err != nil {
return nil, false, err
}
encStartAfter, err := startAfter.Encrypt(s.rootKey)

prefixNoBucket := paths.Path([]string(prefix)[1:])
prefixKey, err := prefixNoBucket.DeriveKey(s.rootKey, len(prefixNoBucket))
if err != nil {
return nil, false, err
}

encStartAfter, err := startAfter.Encrypt(prefixKey)
if err != nil {
return nil, false, err
}
encEndBefore, err := endBefore.Encrypt(s.rootKey)
encEndBefore, err := endBefore.Encrypt(prefixKey)
if err != nil {
return nil, false, err
}
Expand All @@ -401,7 +408,7 @@ func (s *streamStore) List(ctx context.Context, prefix, startAfter, endBefore pa
if err != nil {
return nil, false, err
}
decPath, err := item.Path.Decrypt(s.rootKey)
decPath, err := item.Path.Decrypt(prefixKey)
if err != nil {
return nil, false, err
}
Expand Down

0 comments on commit 50a20cc

Please sign in to comment.