mirror of
https://github.com/nspcc-dev/neofs-rest-gw.git
synced 2026-03-01 04:29:14 +00:00
Gateway can deny bearer token accepted by NeoFS itself #78
Labels
No labels
I2
I3
I3
I4
S2
S3
S3
S4
U0
U1
U2
U3
U3
U3
U4
blocked
bug
config
documentation
enhancement
feature
go
help wanted
question
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neofs-rest-gw#78
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cthulhu-rider on GitHub (Apr 1, 2024).
NeoFS bearer token was recently extended with new field (https://github.com/nspcc-dev/neofs-api/issues/266). Now it has one more field that could be signed and transferred. I tried to use the latest token version w/o REST gateway upgrade (being done in https://github.com/nspcc-dev/neofs-rest-gw/pull/176) and see how it goes
Current Behavior
REST denies bearer token:
while NeoFS accepts it.
Expected Behavior
REST accepts valid bearer token and op proceeds in the same way as when contacting directly to NeoFS
Possible Solution
this is a function that handles passed bearer token. As we can see, it:
currently, signature mismatch is expected cuz:
next can be done to solve the problem:
Describe alternatives you've considered
Steps to Reproduce
Context
btw storage nodes are not forward compatible too. We can do same steps with upgraded REST and "old" nodes. Then output is:
but it consistent with NeoFS (CLI) itself:
same problem may be encountered by any app which inherit NeoFS binary models
Regression
no: this worked (and still), but iff SDK revisions are synced
Your Environment
neofs-dev-env@155e022bd96cdde14b4fdf4a6d2c125147c9bcb8with modified versions in.envfileneofs-nodeandneofs-clifrom https://github.com/nspcc-dev/neofs-node/pull/2787. If merged, latest can be usedneofs-rest-gw@v0.8.3@roman-khimov commented on GitHub (Apr 1, 2024):
The desired behavior is likely:
This is strongly related to https://github.com/nspcc-dev/neofs-api/issues/241, I'd like to have a token that can be created on the user side without reliance on the REST gateway (which is technically possible, but not trivial at the moment, so REST users like Panel never do this). This would mean that REST should be more transparent, but it can provide some additional API specifically to check tokens as they're known to the gateway.
@smallhive commented on GitHub (Apr 15, 2024):
There are some hidden things. The problem is deeper than it looks on the first sight. In fact the problem could be mirrored to node, if the gate would be updated first for the new version of SDK. In this case the gate approves the token, but node will say "invalid signature" error.
In the node we have the same place, where we have to
unmarshaltoken to struct from binary or json representation. It is required to be able to pass the token to commands via parameters.We can try to make this thing more transparent for the gate in case the gate will not interfere inside token. But this require new command API like
WithBearerTokenBinary(token []byte)instead ofWithBearerToken(t bearer.Token).