-
Notifications
You must be signed in to change notification settings - Fork 18
tests: add session token v2 tests #1266
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
base: master
Are you sure you want to change the base?
Conversation
636f984 to
6f719fc
Compare
|
Current issues:
All tests can be run from the current PR, no special configurations are needed, just the node binary from the session tokens PR. |
roman-khimov
left a comment
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.
Wildcard container tokens can be extended with tokens for specific container only, this needs to be checked. I'd also like to see more negative scenarios (like trying to extend cid-specific token with wildcard or using more verbs in delegated token than allowed by original, etc).
pytest_tests/lib/helpers/nns.py
Outdated
| rpc_endpoint=f"http://{neofs_env.fschain_rpc}", | ||
| wallet_config=neo_go_wallet_config, | ||
| method="addRecord", | ||
| arguments=f"{domain} 16 string:{wallet.address}", |
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 expected to see Neo (100) type here (and AddNeoRecord call). @End-rey?
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.
Updated, works with 100 and AddNeoRecord as well
| subjects: List of subject user IDs authorized to use the token. | ||
| subject_nns: List of subject NNS names authorized to use the token. | ||
| contexts: List of context specs in format: containerID:verbs[:objectID1,objectID2,...]. | ||
| Use '0' for wildcard container. Contexts and verbs should be sorted. |
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.
Sorting in done CLI-side now.
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.
Updated, also changed tests to use non-sorted verbs
| with allure.step("Create V2 Session Token with container operations"): | ||
| contexts = ["0:CONTAINERDELETE,CONTAINERPUT"] | ||
|
|
||
| if use_delegation: |
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.
This chunk can probably be moved out, same as in previous test.
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.
fixed
| ) | ||
|
|
||
| with allure.step("Create delegated token for user to perform operations"): | ||
| with pytest.raises(Exception, match=".*final token cannot be used as origin.*"): |
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.
Should be also forced to create this invalid token and then check that requests fail with it.
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.
force is not yet implemented
4d7fccd to
34d0cdf
Compare
closes #823 Signed-off-by: Evgeniy Zayats <[email protected]>
34d0cdf to
c418e7d
Compare
| contracts_hashes["nns"], | ||
| rpc_endpoint=f"http://{neofs_env.fschain_rpc}", | ||
| wallet_config=neo_go_wallet_config, | ||
| method="AddNeoRecord", |
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.
| method="AddNeoRecord", | |
| method="addNeoRecord", |
| rpc_endpoint=f"http://{neofs_env.fschain_rpc}", | ||
| wallet_config=neo_go_wallet_config, | ||
| method="AddNeoRecord", | ||
| arguments=f"{domain} 100 string:{wallet.address}", |
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.
The method works with a specific type Neo, so there is no need to write 100. Also, use Uint160 script hash instead of a string. There should be only 2 arguments: domain and hash of address.
| 1. Register NNS domain name for owner wallet | ||
| 2. Add NNS record for the domain | ||
| 3. Create V2 session token with NNS subject for owner | ||
| 4. Verify owner can perform operations using the token |
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.
If I understand correctly, this test does not verify the correctness of the claim. In this case, all requests will go through an ephemeral key, so it does not matter what other subjects are in the token. What can be verified here is that if the node key is placed in nns and then this node is requested (it must be a different node from the one used to create the token), then everything should work. In this case, the object must be created with the node key, not the ephemeral key. You can also try adding several nodes to one nns and check that requests can be made from all nodes.
closes #823