session: add a new session token v2#350
Conversation
e65a42a to
11f58a6
Compare
11f58a6 to
694d30d
Compare
b967342 to
7a51333
Compare
session/types.proto
Outdated
| ObjectSessionContextV2 object = 6 [json_name = "object"]; | ||
|
|
||
| // ContainerService authorization context. | ||
| ContainerSessionContextV2 container = 7 [json_name = "container"]; |
There was a problem hiding this comment.
Maybe we can have a single set of object/container operations? I'm not sure what this separation buys us.
7a51333 to
45af0fd
Compare
d863037 to
f7f489d
Compare
f7f489d to
a4dfb59
Compare
roman-khimov
left a comment
There was a problem hiding this comment.
But it looks good, pretty simple but powerful structure.
a4dfb59 to
1a8c6a1
Compare
1a8c6a1 to
5278238
Compare
b32a054 to
1642d22
Compare
roman-khimov
left a comment
There was a problem hiding this comment.
Good otherwise. ID is not critical, but I just don't see any use for it. Maybe @carpawell or @cthulhu-rider do.
session/types.proto
Outdated
| uint32 version = 1 [json_name = "version"]; | ||
|
|
||
| // Token identifier (UUIDv4 in binary form). | ||
| bytes id = 2 [json_name = "id"]; |
There was a problem hiding this comment.
Can be uint32 nonce. We have no use for this ID other than to prevent collisions.
There was a problem hiding this comment.
does anyone see usecase for creating additional token that differs only in id?
There was a problem hiding this comment.
I treat it like a transaction nonce. Same version, same policy, same everything, but we want to have a different ID of course. For that UUID is an overkill.
There was a problem hiding this comment.
But why would anyone want to create the same token with different ID is a mystery. Maybe it can happen accidentally though. Like some code has lost the old token and then it creates a new one.
There was a problem hiding this comment.
what do you suggest to use as a token id? currenlty, a pair of owner/tokenID is used in node's cache. hash body?
There was a problem hiding this comment.
And that's more secure, because UUID can be reused in completely different tokens, it should never be used for caching.
There was a problem hiding this comment.
tbh, never liked uuid and the way it was gotten from the user without any uniqueness guarantees. support dropping it
There was a problem hiding this comment.
currently, sys behavior is identical for two tokens that differ only in id. For example, the fact that some token was lost and recreated on user side (this is possible with RFC6979 signature scheme) still cannot be verified. However, caching will require more resources
There was a problem hiding this comment.
So, drop id and use for caching hash body?
There was a problem hiding this comment.
Replace is with 32 bit nonce. Just in case we need some randomness. Otherwise they're identified by hashes (like containers or objects are, for example).
| // Signature of the body by the issuer. | ||
| neo.fs.v2.refs.Signature signature = 2 [json_name = "signature"]; | ||
|
|
||
| // Origin token that was delegated to create this token. |
There was a problem hiding this comment.
mention that delegation cannot be wider than the previous one in the chain?
session/types.proto
Outdated
| uint32 version = 1 [json_name = "version"]; | ||
|
|
||
| // Token identifier (UUIDv4 in binary form). | ||
| bytes id = 2 [json_name = "id"]; |
There was a problem hiding this comment.
what do you suggest to use as a token id? currenlty, a pair of owner/tokenID is used in node's cache. hash body?
cthulhu-rider
left a comment
There was a problem hiding this comment.
how about this case
Line 200 in ff6de9a
session/types.proto
Outdated
| SessionToken session_token = 5 [json_name = "sessionToken"]; | ||
|
|
||
| // Session token v2 with delegation chain support. | ||
| // If both session_token and session_token_v2 are set, session_token_v2 takes precedence. |
There was a problem hiding this comment.
i'd consider such requests invalid
There was a problem hiding this comment.
We once discussed that both tokens are possible and they do not interfere with each other @roman-khimov
There was a problem hiding this comment.
They don't interfere in that you can use one or another, but mixing them would be strange and we can forbid it immediately to prevent any inconsistencies.
1642d22 to
4190114
Compare
4190114 to
b3207f5
Compare
|
I think we won't merge for now, just in case. |
b3207f5 to
ff19835
Compare
Session Token v2 solves the delegation, power of attorney, and chain-of-trust problems. It enables: - Account-based authority (direct or NNS-based indirect) - Multi-account subjects (multiple entities can use same token) - Multi-verb operations (GET, PUT, DELETE in single token) - Delegation chains (verifiable like X.509 certificates) - Indirect accounts (NeoFS Name Service resolution) Refs #241. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Refs #241.