Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neofs-cli doesn't support raw session tokens #1933

Closed
anikeev-yadro opened this issue Oct 19, 2022 · 2 comments · Fixed by #1934
Closed

neofs-cli doesn't support raw session tokens #1933

anikeev-yadro opened this issue Oct 19, 2022 · 2 comments · Fixed by #1934
Assignees
Labels
bug Something isn't working U0 Needs to be resolved immediately
Milestone

Comments

@anikeev-yadro
Copy link

Expected Behavior

neofs-cli should support raw and json session tokens

Current Behavior

neofs-cli doesn't support raw session tokens

Steps to Reproduce (for bugs)

  1. Create raw session token:
hexdump -C /jenkins/workspace/sbercloud_test/tmp.jpP3Z9fI2U/neofs-testcases/TemporaryDir/78dbd370-340f-4ea7-9689-d2fd399fe277
00000000  0a 41 0a 10 30 e6 c2 11  69 42 4d c1 a3 d6 40 94  |.A..0...iBM...@.|
00000010  dc fb 5f 18 1a 06 08 17  10 0d 18 0d 22 21 03 96  |.._........."!..|
00000020  f4 fa 6c 0b 02 74 fc b1  2b ba 72 b1 97 6e 16 50  |..l..t..+.r..n.P|
00000030  f0 76 1b bb bf 01 ab 2f  92 42 4a 42 84 1a cf 2a  |.v...../.BJB...*|
00000040  02 12 00                                          |...|
00000043
  1. Try to use it:
15:27:03 [INFO] Command: neofs-cli --config /jenkins/workspace/sbercloud_test/tmp.jpP3Z9fI2U/neofs-testcases/wallet_config.yml object head --rpc-endpoint '172.26.161.165:8080' --wallet '/jenkins/workspace/sbercloud_test/tmp.jpP3Z9fI2U/neofs-testcases/TemporaryDir/70a99652-3685-43e3-b8d8-3c29d2ced1e3.json' --cid '3GenE6KnxiRAvBssMbTRcNmhgQamiz1yrh7FP1R91yov' --oid 'ATVU839E2zUJwbYkgC93KStGpASsXrTZu653ZUfcn73D' --json --session '/jenkins/workspace/sbercloud_test/tmp.jpP3Z9fI2U/neofs-testcases/TemporaryDir/78dbd370-340f-4ea7-9689-d2fd399fe277'
Error:
return code: 1 
Output: could not unmarshal session token from file: proto: syntax error (line 2:1): invalid value A

Versions:

NeoFS CLI
Version: v0.33.0-6-g4c63be66 
GoVersion: go1.18.4

NeoFS Storage node
Version: v0.33.0-6-g4c63be66
GoVersion: go1.18.4

Your Environment
Server setup and configuration:
cloud, 4 VMs, 4 SN, 4 http qw, 4 s3 gw

Operating System and version (uname -a):
linux vedi 5.10.0-16-amd64 #1 SMP Debian 5.10.127-1 (2022-06-30) x86_64 GNU/Linux

@fyrchik
Copy link
Contributor

fyrchik commented Oct 19, 2022

I think we accidentally lost the ability to unmarshal tokens in raw format here #1873

@cthulhu-rider
Copy link
Contributor

It is expected according to command description

$ neofs-cli object head -h
...
--session string        Path to a JSON-encoded container session token
...

So we need to support it.

@cthulhu-rider cthulhu-rider self-assigned this Oct 20, 2022
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
There is a need to support NeoFS-binary sessions along with JSON ones in
NeoFS CLI.

Provide generic `common.ReadBinaryOrJSON` functions which tries to
decode NeoFS-binary structure and falls back to JSON format. Use this
function in all places with token reading.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
…lete`

In current implementation `put` and `delete` commands of `object`
session in the NeoFS CLI stores objects in the container using remote
session. According to this, it doesn't make sense to accept static
sessions: such sessions will have no effect or fail the operation.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
There is a need to support NeoFS-binary sessions along with JSON ones in
NeoFS CLI.

Provide generic `common.ReadBinaryOrJSON` functions which tries to
decode NeoFS-binary structure and falls back to JSON format. Use this
function in all places with token reading.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
…lete`

In current implementation `put` and `delete` commands of `object`
session in the NeoFS CLI stores objects in the container using remote
session. According to this, it doesn't make sense to accept static
sessions: such sessions will have no effect or fail the operation.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
…lete`

In current implementation `put` and `delete` commands of `object`
session in the NeoFS CLI stores objects in the container using remote
session. According to this, it doesn't make sense to accept static
sessions: such sessions will have no effect or fail the operation.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
There is a need to support NeoFS-binary sessions along with JSON ones in
NeoFS CLI.

Provide generic `common.ReadBinaryOrJSON` functions which tries to
decode NeoFS-binary structure and falls back to JSON format. Use this
function in all places with token reading.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
…lete`

In current implementation `put` and `delete` commands of `object`
session in the NeoFS CLI stores objects in the container using remote
session. According to this, it doesn't make sense to accept static
sessions: such sessions will have no effect or fail the operation.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
There is a need to support NeoFS-binary sessions along with JSON ones in
NeoFS CLI.

Provide generic `common.ReadBinaryOrJSON` functions which tries to
decode NeoFS-binary structure and falls back to JSON format. Use this
function in all places with token reading.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
There is a need to support NeoFS-binary sessions along with JSON ones in
NeoFS CLI.

Provide generic `common.ReadBinaryOrJSON` functions which tries to
decode NeoFS-binary structure and falls back to JSON format. Use this
function in all places with token reading.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
cthulhu-rider added a commit to cthulhu-rider/neofs-node that referenced this issue Oct 20, 2022
Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working U0 Needs to be resolved immediately
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants