nspcc-dev / neofs-node

NeoFS is a decentralized distributed object storage integrated with the Neo blockchain
https://fs.neo.org
GNU General Public License v3.0
32 stars 38 forks source link

Static session does not expire in the next epoch #2383

Closed vvarg229 closed 1 year ago

vvarg229 commented 1 year ago

The tests "Validate static session which expires at next epoch" and "Validate static session that is valid" do not work because the session token has not expired.

If I understand correctly, after the second tick of the epoch:

  1. First tick:
    self.tick_epoch()
        head_object(
            user_wallet.path,
            container,
            object_id,
            self.shell,
            self.cluster.default_rpc_endpoint,
            session=token_start_at_next_epoch,
        )
  2. Second tick: self.tick_epoch()

we expect to get an error "session token has expired", but it's not happening:

COMMAND: neofs-cli --config /home/runner/work/neofs-node/neofs-node/neofs-testcases/wallet_config.yml object head --rpc-endpoint 's01.neofs.devenv:8080' --wallet '/home/runner/work/neofs-node/neofs-node/neofs-testcases/TemporaryDir/8f20109b-23f5-427c-b8b3-44a5124aa384.json' --cid '2LSsEJABGAwwJr4hqGUf6647mYwpsxajvbnAr1gnPbQL' --oid 'kgqiYoYiVSXBSJB19fMFixJi2VMKSar8mAhvrPSaYSq' --json --session '/home/runner/work/neofs-node/neofs-node/neofs-testcases/TemporaryDir/TestFilesDir/6a83bfce-0acb-401f-bd70-1db9d0e2cf76'
RETCODE: 0

STDOUT:
{"objectID":{"value":"CzEFno93OQJypfcPQjV5rD/ScQ/InaU5gTFhXzoMp24="}, "signature":{"key":"A0oRwfnyd1S2A9O94S6GdrHhHCI50V1AUn/XVgumd9ym", "signature":"owxarcx+i+oYOtv1P/j4IY1e2r0xC/liVBHiwJGsrvh09oHBy1+CYMfVgBHNV28LjXlk/WYubiY684Cf/QwybA==", "scheme":"ECDSA_RFC6979_SHA256"}, "header":{"version":{"major":2, "minor":13}, "containerID":{"value":"E9b4FxeolDM+QZ6zeHvIrP1dk+0XRpdPnhACdS6BqDE="}, "ownerID":{"value":"Nd5VJhaasv4m/ycf6cMo2h7bALR16UUpVw=="}, "creationEpoch":"105", "payloadLength":"201327592", "payloadHash":{"type":"SHA256", "sum":"7u+trBjtf5tLZOSFOcF7DHawhSybyYniu5jfjVwBoiU="}, "objectType":"REGULAR", "homomorphicHash":{"type":"TZ", "sum":"BEAbpsoj30AXWioBBBIQaiy8BfH565cPebAbML6bhPsW/7Uq6Mse5Ms/aTRCZ4unHJoCfgctHqAQ2V576RomCg=="}, "sessionToken":{"body":{"id":"UF2HcjxVS+OFWoALIYnT1Q==", "ownerID":{"value":"Nd5VJhaasv4m/ycf6cMo2h7bALR16UUpVw=="}, "lifetime":{"exp":"115", "nbf":"105", "iat":"105"}, "sessionKey":"A0oRwfnyd1S2A9O94S6GdrHhHCI50V1AUn/XVgumd9ym", "object":{"verb":"PUT", "target":{"container":{"value":"E9b4FxeolDM+QZ6zeHvIrP1dk+0XRpdPnhACdS6BqDE="}, "objects":[]}}}, "signature":{"key":"Ax0yV7TMsLgeLp7fAOXtM7ErgV84+wPCN/XQ24KxLQLd", "signature":"jZ1ioZ+vf5o+5Y5B4xuBlUBwhoXxVwPqBpw13ThmRuwPCIaBzHSRk4ORfKCH1SXWMi5IERHZkhT6IwP9SPuJiA==", "scheme":"ECDSA_RFC6979_SHA256"}}, "attributes":[{"key":"FileName", "value":"a67d5cdd-aa8d-4194-a47e-8eb1d771f3cb"}, {"key":"Timestamp", "value":"1686753128"}], "split":null}, "payload":""}

STDERR:

Start / End / Elapsed    14:35:23.400490 / 14:35:23.849267 / 0:00:00.448777

See logs: https://github.com/nspcc-dev/neofs-node/actions/runs/5267489783/jobs/9522807183 https://nspcc-dev.github.io/neofs-node/208/#categories/4b1b218519a23f484ef3888ffcf04b79/bcbea02514c8dda1/

Expected Behavior

We should get a message that the session token has expired.

Current Behavior

Steps to Reproduce (for bugs)

Run automated system tests.

Context

I'm trying to get consistently green tests.

Regression

Yes

Your Environment

Ubuntu-latest GitHub runner
neo-go 0.101.1
neofs-s3-authmate 0.27.0
neofs-cli c4f59679
neofs-adm c4f59679
neofs-ir c4f59679 
neofs-lens c4f59679 
neofs-cli c4f59679 
aws-cli/2.11.20 
Python/3.11.3 
Linux/5.15.0-1038-azure exe/x86_64.ubuntu.22 prompt/off
vvarg229 commented 1 year ago

If it's really a bug, then the tests https://github.com/nspcc-dev/neofs-testcases/issues/535 was falling correctly.

cthulhu-rider commented 1 year ago

@vvarg229 IIUC we set exp to epoch N (99), and send request at epoch N. Currently, resulting behavior is expected and corresponds to the implementation: request is valid at epoch N and invalid starting from N+1

we have an open issue in protocol related to this topic https://github.com/nspcc-dev/neofs-api/issues/253

if I didn't mess up the epoch numbers, i suggest to rework the test:

roman-khimov commented 1 year ago

No bug.