-
Notifications
You must be signed in to change notification settings - Fork 50
Session token V2 #3671
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
Session token V2 #3671
Conversation
5bba446 to
f730e2f
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3671 +/- ##
==========================================
- Coverage 25.67% 25.56% -0.12%
==========================================
Files 660 660
Lines 42177 42665 +488
==========================================
+ Hits 10830 10907 +77
- Misses 30363 30753 +390
- Partials 984 1005 +21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
41ab8d0 to
e66bf4b
Compare
eed01c8 to
f9d051d
Compare
5b82365 to
cea1b4d
Compare
cea1b4d to
2122d4d
Compare
eb453b4 to
1a9aab2
Compare
1a9aab2 to
b39cd77
Compare
9fb4519 to
04b1e68
Compare
|
Added nns resolver to get, put, delete, and search services to verify v2 tokens as well as v1 tokens. Is this approach with a single nns resolver acceptable? |
04b1e68 to
96a1be0
Compare
|
Ref nspcc-dev/neofs-testcases#1266 (comment). |
96a1be0 to
8384476
Compare
| Signature() (neofscrypto.Signature, bool) | ||
| Issuer() user.ID | ||
| Iat() time.Time | ||
| }](token T, fsChain HistoricN3ScriptRunner) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you choose a generic type for smth that is called TokenV2? can it be anything other than that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made like in #3778:
neofs-node/pkg/services/container/server.go
Line 383 in 2931333
| if err := icrypto.AuthenticateTokenV2(sessionTokenV2WithEncodedBody{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements support for Session Token V2, a new session token format for NeoFS, enabling multi-subject authorization, NNS name resolution, and token delegation chains. The implementation maintains backward compatibility with V1 tokens.
Changes:
- Added Session Token V2 support across object and container services with multi-subject authorization and NNS resolution
- Introduced chain time provider for time-based token validation using blockchain timestamps
- Removed deprecated temporary session storage in favor of persistent storage only
- Enhanced CLI with
session create-v2command and automatic server-side session key creation
Reviewed changes
Copilot reviewed 66 out of 67 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/chaintime/chaintime.go | New atomic chain time provider for V2 token time validation |
| internal/crypto/tokens.go, object.go, n3.go | Added V2 token authentication with time-based verification |
| pkg/util/state/token.go | Added FindTokenBySubjects for V2 multi-subject token lookup |
| pkg/util/state/session/temporary/* | Removed temporary in-memory storage (deleted files) |
| pkg/services/object/* | V2 token support in get, put, search, delete operations |
| pkg/services/container/server.go | V2 token verification for container operations |
| pkg/services/object/acl/v2/service.go | V2 token ACL checks with NNS resolver integration |
| cmd/neofs-cli/modules/session/create_v2.go | CLI command to create V2 tokens with server-side keys |
| cmd/neofs-cli/modules/object/* | Object commands updated for V2 token support |
| pkg/innerring/processors/container/* | Inner ring V2 token processing |
| go.mod, go.sum | Updated neofs-sdk-go dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8384476 to
cb51efe
Compare
cb51efe to
d384855
Compare
d384855 to
8d4a70c
Compare
Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Add invoke of netmap contract function `GetEpochBlockByTime`. Use it to verify n3 scripts of session token v2. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Set subjects to default session token from `session-subjects` and `session-subjects-nns` flags for put, delete and lock operations. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Implementation of nns resolver for session token v2. Uses cache to optimize requests. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Check new session tokens in inner ring container processors. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Check container requests with new v2 session tokens, verify them using the nns resolver. Use `OriginalIssuer` in container operation CLI commands. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Check object requests with new v2 session tokens, verify them using the nns resolver. Pass the v2 session token through the slicer, set them to the object session token, and authorize objects using the token. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
8d4a70c to
8a4e2a0
Compare
Refs nspcc-dev/neofs-api#350, nspcc-dev/neofs-sdk-go#750