From 7ea6a756af8455bb2c9be8a28aef1b602c3f6091 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Feb 2024 23:41:22 +0300 Subject: [PATCH 1/2] node: Add session token's key decoding error details Signed-off-by: Pavel Karpy --- pkg/services/container/morph/executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/container/morph/executor.go b/pkg/services/container/morph/executor.go index 26215cb5ed..a78e77c134 100644 --- a/pkg/services/container/morph/executor.go +++ b/pkg/services/container/morph/executor.go @@ -361,7 +361,7 @@ func (s *morphExecutor) validateToken(t *sessionV2.Token, cIDV2 *refs.ContainerI err = keyFromToken.Decode(t.GetSignature().GetKey()) if err != nil { - return errors.New("error while decoding public key from the token's signer") + return fmt.Errorf("decoding key from signature: %w", err) } userFromToken := user.ResolveFromECDSAPublicKey(ecdsa.PublicKey(keyFromToken)) From 8858b3042a9d69d7faf24d5fde1b8dcc5416ed54 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Feb 2024 23:45:20 +0300 Subject: [PATCH 2/2] node: Print v2 user base58-encoded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now we have such errors: `code = 1024 message = session was not issued by the container owner, issuer: "52\n\xad\xc8\x18\x9f<\xf6V\x94\xf7î\xfd\xe1Ia\x05\xecӰ\xedE\x19"` but can do it better for sure. Signed-off-by: Pavel Karpy --- pkg/services/container/morph/executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/container/morph/executor.go b/pkg/services/container/morph/executor.go index a78e77c134..79a6c9eb7b 100644 --- a/pkg/services/container/morph/executor.go +++ b/pkg/services/container/morph/executor.go @@ -354,7 +354,7 @@ func (s *morphExecutor) validateToken(t *sessionV2.Token, cIDV2 *refs.ContainerI } if issuer := t.GetBody().GetOwnerID().GetValue(); !bytes.Equal(cnr.Value.Owner().WalletBytes(), issuer) { - return fmt.Errorf("session was not issued by the container owner, issuer: %q", issuer) + return fmt.Errorf("session was not issued by the container owner, issuer: %s", base58.Encode(issuer)) } var keyFromToken neofsecdsa.PublicKey