tree: Allow reading requests signed by keys from allow list #458
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#458
Loading…
Reference in a new issue
No description provided.
Delete branch "acid-ant/frostfs-node:feature/449-tree-allowed-keys"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Close #449
Signed-off-by: Anton Nikiforov an.nikiforov@yadro.com
e7b758e90c
toe26fd1f24a
@ -127,0 +130,4 @@
// keys that have rights to use Tree service.
func WithAuthorizedKeys(keys [][]byte) Option {
return func(c *cfg) {
c.authorizedKeys = append(c.authorizedKeys, keys...)
Looks like in the most of options with slice as argeument (see metabase, blobstore) we replace slice, but not append to slice.
Thanks, fixed.
e26fd1f24a
to1579ba24ab
1579ba24ab
toa9513f78d2
@ -47,11 +47,6 @@ var errBearerSignature = errors.New("invalid bearer token signature")
// - 1. ObjectPut;
// - 2. ObjectGet.
func (s *Service) verifyClient(req message, cid cidSDK.ID, rawBearer []byte, op acl.Op) error {
err := verifyMessage(req)
Why did you move it outside?
verifyClient
is supposed to be a function which checks access rights.We have
op
which is equal toacl.OpObjectGet
for read operations.Oops, the idea was not to do that check twice. Now I see that I can compare key with allow list and after that verify message.
Updated, please review.
a9513f78d2
tocf8a2837ef
@ -74,0 +78,4 @@
// parameter from "tree" section.
//
// Returns an empty list if not set.
func (c TreeConfig) AuthorizedKeys() [][]byte {
Not important, but why not return
keys.PublicKeys
? This is what we do in a control service and[]byte
could be a purely tree service optimization.Just want to hide
[][]byte
creation. Don't mind usingPublicKeys
. Updated.@ -327,3 +327,2 @@
err := s.verifyClient(req, cid, b.GetBearerToken(), acl.OpObjectGet)
if err != nil {
if allowed, err := s.isAuthorizedClient(req); err != nil {
Again, why can't we move
isAuthorizedClient
insideverifyClient
?It is the same access control.
Gotcha, updated.
cf8a2837ef
to53a2fd2cee
@ -42,6 +42,12 @@ func initTreeService(c *cfg) {
return
}
pubs := treeConfig.AuthorizedKeys()
What about doing it inside the service? I mean it accepts public keys, everything else (comparing byte-slices is an internal optimization detail)
omg, where is my head?) Done.
53a2fd2cee
toc9da42232b
@fyrchik should we reload these keys on SIGHUP?
@ -54,0 +61,4 @@
}
var key = sign.GetKey()
for i := range s.authorizedKeys {
if bytes.Equal(s.authorizedKeys[i].Bytes(), key) {
This will lead to multiple allocations on each tree service operation.
Can we cache this
[][]byte
somehow?I've meant that
WithAuthorizedKeys
should acceptkeys.PublicKeys
, but, for example, we can also convert everything to bytes right there.You are right, done.
c9da42232b
to598a278e25
598a278e25
toa3cf8858d7
a3cf8858d7
to8e84452020
8e84452020
toab489265b3