Make container service set correct APE-request targets before the check #1504
No reviewers
TrueCloudLab/storage-core-developers
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#1504
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/frostfs-node:fix/cnt_svc_ape_target"
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?
The scenario in #1503 in short:
We set APE-chain for a container target. While it's being set up in
Policy
contract (1),GetContainer
is performed.GetContainer
performs APE-check by multi-target.If the container target is also set to this multi-target, then it triggers an APE-chain cache refresh, initially with an empty chain list, because (1) is not finished yet. So, we should wait for the cache value invalidation when it's unnecessary in fact.
Close #1503
Make container service set correct APE-request before the checkto Make container service set correct APE-request targets before the check@ -330,3 +330,1 @@
s, found, err := ac.router.IsAllowed(apechain.Ingress,
policyengine.NewRequestTargetExtended(namespace, id.EncodeToString(), fmt.Sprintf("%s:%s", namespace, pk.Address()), groups),
request)
rt := policyengine.NewRequestTargetWithNamespace(namespace)
Changing resource here is a functional change which is completely unrelated to cache.
Please, explain why nothing breaks with this change for already existing change.
IsAllowed -> checkMorph -> matchMorphRuleChains -> ListMorphRuleChains
Check Put method or
List
. It's correct that container id is not set to the multi-targetInitially for Get, this looked like that:
then we left
id.EncodeToString()
but added namespace. This is nonsense for the container operationGetContainer
as container operations must be defined only within namespace, user and groups. Container target defines object operations over container.This fix indirectly resolves #1503 but from my POV we need this change anyway. I don't like the idea that
GetContainer
can be allowed/restricted by setting chain to container target . We have namespace for thisMoreover, I found a mistake of mine in a unit-test with name
"check testdomain-defined container in testdomain namespace target rule"
.I believe I did it in haste because the test didn't check what it was supposed to. It passed so far because the default policy (
addDefaultAllowGetPolicy
) has reset container policy - that was absolutely incorrectThis is a proof why Container target shouldn't be set in the multi-target
It doesn't matter, the code in
pkg/services/container
should know nothing about the cache, it creates request context and applies APE rules. You seem to change what we do here.We also need to stay compatible with existing deployments. My question about "nothing breaks" was because of this, and it has remained unanswered.
Following your logic, what should the resources for
object.*
operations be?The problem with cache pushed me to check the listing from
GetContainer
operation. I was confused when I sawcontainerTarget
in the multi-target (see explanation below). I agree it looks unrelated and absolutely not obvious but it seems it accidently helped a bit with #1503 (see comment). The proper solution for #1503 is #1506.Object resources and operations are associated with container (and can be with namespace target although it's not correct). If you meant
container.*
then I associated them with namespace, user and group.I believe that could be checked with auto-tests. We could make sure no client creates
GetContainer, DeleteContainer
rules within the container target.Anyway, this problem requires thorough research and testing. I am going to close this PR
8408635c94
tocd97b1a1ba
New commits pushed, approval review dismissed automatically according to repository settings
cd97b1a1ba
tobb2488acfe
Make container service set correct APE-request targets before the checkto WIP: Make container service set correct APE-request targets before the checkbb2488acfe
toe883fa35f1
WIP: Make container service set correct APE-request targets before the checkto Make container service set correct APE-request targets before the checkAddChain
update/invalidate APE cache? #1503This PR affects sensitive middleware in container service. So, this requires detailed research and, actually, this is not proper fix for #1503.
See this comment
Pull request closed