From 2f783dfad7d2d8f76512b836b6fcb81e7e18b33b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 6 Jul 2021 11:18:25 +0300 Subject: [PATCH] [#323] pkg/client: Prevent corruption of parameterized session token Create new `SessionTokenBody` instead of using one from the parameter in order to prevent data corruption. Signed-off-by: Leonard Lyubich --- pkg/client/object.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 62e895ea..60d29705 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -1302,7 +1302,6 @@ func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.Requ } token := new(v2session.SessionToken) - token.SetBody(opts.session.ToV2().GetBody()) opCtx := new(v2session.ObjectSessionContext) opCtx.SetAddress(info.addr) @@ -1313,7 +1312,9 @@ func (c *clientImpl) attachV2SessionToken(opts *callOptions, hdr *v2session.Requ lt.SetNbf(info.nbf) lt.SetExp(info.exp) - body := token.GetBody() + body := new(v2session.SessionTokenBody) + body.SetID(opts.session.ID()) + body.SetOwnerID(opts.session.OwnerID().ToV2()) body.SetSessionKey(opts.session.SessionKey()) body.SetContext(opCtx) body.SetLifetime(lt)