From fd61bdadcb8af69af211fda14398ba81e8bed22c Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Nov 2022 19:39:11 +0300 Subject: [PATCH] [#2040] node: Attach original meta to the spawned requests Do not lose meta information of the original requests: cache session and bearer tokens of the original request b/w a new generated ones. Middle request wrappers should not contain any meta information, since it is useless (e.g. ACL service checks only the original tokens). Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + pkg/services/object/util/prm.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 974025bec..2d5109a9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Changelog for NeoFS Node - Fix concurrent map writes in `Object.Put` service (#2037) - Malformed request errors' reasons in the responses (#2028) - Session token's IAT and NBF checks in ACL service (#2028) +- Losing meta information on request forwarding (#2040) ### Removed ### Updated diff --git a/pkg/services/object/util/prm.go b/pkg/services/object/util/prm.go index 80dd84b01..952f12824 100644 --- a/pkg/services/object/util/prm.go +++ b/pkg/services/object/util/prm.go @@ -102,6 +102,12 @@ func CommonPrmFromV2(req interface { GetMetaHeader() *session.RequestMetaHeader }) (*CommonPrm, error) { meta := req.GetMetaHeader() + ttl := meta.GetTTL() + + // unwrap meta header to get original request meta information + for meta.GetOrigin() != nil { + meta = meta.GetOrigin() + } var tokenSession *sessionsdk.Object var err error @@ -116,7 +122,6 @@ func CommonPrmFromV2(req interface { } xHdrs := meta.GetXHeaders() - ttl := meta.GetTTL() prm := &CommonPrm{ local: ttl <= maxLocalTTL,