ape: Make services use bearer chains fed router #1216
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
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1216
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/frostfs-node:feat/bt_router"
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?
BearerChainFedRouter
performs checks for overrides defined in the bearer token;2459a508ee
to51e35f200f
LGTM
@ -0,0 +47,4 @@
}
return &bearerChainFedRouter{
// morphReaderStub is the trick to check only local overrides skipping policy contract chains.
How about to pass
nil
instead ofstub
and fixpolicy-engine
a bit?From the point of defaultChainRouter morph rules are mandatory. I could disable the check by passing
nil
, but I prefer thorough refactoring ofdefaultChainRouter
in the future.51e35f200f
to11173991c1
@ -15,11 +13,9 @@ import (
)
type accessPolicyEngine struct {
mtx sync.RWMutex
Why was it protected with mutex before?
TBH, I don't remember. As far as I can recall I put this mutex guard had been added on someone's demand in pull request's review and probably the design was changed but mutex has been left.
When I glanced at the code again I found this guard useless.
After I removed this guard I tested the storage node with k6 (10 writers, 10 readers) - I found no concurrency panics
@ -0,0 +71,4 @@
return
}
status, ruleFound, err = br.morphRuleChainStorageRouter.IsAllowed(name, rt, r)
There are container chains in the bearer token which are overridden, so no chains from the contract should be applied. It it true for this implementation?
Let's analyze the implementation
So, if the issuer of the bearer token is the container's owner and bearer token contains allowing chains (overrides) for an operation that means an operation would be applied despite policy contract may deny it
And if we have some restrictions on the namespace level?
It seems I can circumvent them by emitting a bearer token for myself.
Okay. You mean that a bearer token can be used as kind of exploit to bypass restrictions on namespace level
isValidBearer
)11173991c1
to48022de5ef
We've had a discussion with @fyrchik (see also this comm).
So, we agreed that namespace-defined chains from Policy contract have got higher priority. Then the router should check bearer token overrides if they're defined for the container target.
An important point:
NoRuleFound
(no matches with request) over bearer token chain rules is returned immediately - even morph storage may contain allowing rule for the target. Thus bearer token totally overrides container target rules in morph storageIt looks like now a local override can allow any operations, regardless of what rules are in the chain. For example, if local override has
allow everything for all
, but blockchain contract containsdeny all operation for all except owner
, then local override'sallow everything for all
wins.I think that local override must only reduce access rights, but not extend.