From 2148e282ec4828df2d36d1212e2f5d28c24422c6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 19 Nov 2020 17:22:45 +0300 Subject: [PATCH] [#190] Rename owner to cnrOwner in object request info `owner` field may be misused as request sender owner, however it is a owner of a container for that request. New naming should be clear. Signed-off-by: Alex Vanin --- pkg/services/object/acl/acl.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/services/object/acl/acl.go b/pkg/services/object/acl/acl.go index ae6eaf46..06db03cb 100644 --- a/pkg/services/object/acl/acl.go +++ b/pkg/services/object/acl/acl.go @@ -56,7 +56,7 @@ type ( requestRole acl.Role isInnerRing bool operation acl.Operation // put, get, head, etc. - owner *owner.ID // container owner + cnrOwner *owner.ID // container owner cid *container.ID @@ -423,7 +423,7 @@ func (b Service) findRequestInfo( info.requestRole = role info.isInnerRing = isIR info.operation = verb - info.owner = cnr.OwnerID() + info.cnrOwner = cnr.OwnerID() info.cid = cid // it is assumed that at the moment the key will be valid, @@ -508,7 +508,7 @@ func basicACLCheck(info requestInfo) bool { } func stickyBitCheck(info requestInfo, owner *owner.ID) bool { - if owner == nil || info.owner == nil { + if owner == nil || info.cnrOwner == nil { return false } @@ -516,7 +516,7 @@ func stickyBitCheck(info requestInfo, owner *owner.ID) bool { return true } - return bytes.Equal(owner.ToV2().GetValue(), info.owner.ToV2().GetValue()) + return bytes.Equal(owner.ToV2().GetValue(), info.cnrOwner.ToV2().GetValue()) } func eACLCheck(msg interface{}, reqInfo requestInfo, cfg *eACLCfg) bool { @@ -640,7 +640,7 @@ func isValidBearer(reqInfo requestInfo, st netmap.State) bool { // 3. Then check if container owner signed this token. tokenIssuerKey := crypto.UnmarshalPublicKey(token.GetSignature().GetKey()) - if !isOwnerFromKey(reqInfo.owner, tokenIssuerKey) { + if !isOwnerFromKey(reqInfo.cnrOwner, tokenIssuerKey) { // todo: in this case we can issue all owner keys from neofs.id and check once again return false }