rooch icon indicating copy to clipboard operation
rooch copied to clipboard

[SessionScope] check the first part of SessionScope is a valid address

Open jolestar opened this issue 3 months ago • 3 comments

Create session with scope *::*::* will cause error

failed: Error: Failed to create DID: Transaction execution failed, execution_info: {"tx_hash":"0x6bb3b0679a5311177c61ab27932a097d40d038a6ee9c10ac5da9944289925de6","state_root":"0x2786db00cccb41d649f02003b1c892fb5e0c3d283567790a63a9bddd19317d08","event_root":"0xc7ae7426e0d03920148ea760e3dd93b5deb19d645dc988ffe73c8686b9fe4a28","gas_used":"19962110","status":{"type":"moveabort","location":"0x2::address","abort_code":"1"}}

We should ensure the first part of SessionScope is a valid address.

jolestar avatar Sep 16 '25 03:09 jolestar

Create session with scope *::*::* will cause error

could you add more context between it and the error? from what i tested creating a session-key, if not session, with the scope will normally be rejected in command line rooch command.

rooch session-key create --app-name nuwa --app-url nuwa.dev --scope *::*::*
error: invalid value '*::*::*' for '--scope <SCOPE>': Unable to parse AccountAddress (must be hex string of length 32)

i only tested command line, maybe from what i saw it could be tested from somewhere else to create did with the session scope.

The Rust code checks the first part, but the move code does not.

jolestar avatar Sep 22 '25 07:09 jolestar

The Rust code checks the first part, but the move code does not.

i was able to reproduce the error above and submitted a patch for it #3728.

rooch move run --function 0x3::session_key::create_session_key_with_scope_strings_entry --args "string:nuwa" --args "string:nuwa.app" --args "string:0x02fb4bca1e905316df4aaab10fa6912931e40a009ffaf98028a1f999e419a7725b" --args "vector<string>:*::*::*" --args "u64:1000000"
Execution info:
    status: MoveAbort { location: StrView(0x0000000000000000000000000000000000000000000000000000000000000002::address), abort_code: StrView(1) }
    gas used: 2872800
    tx hash: 0x2e12b34c3c05df302ccafe77b78280d20f9abffc621a7315a89377ba48499730
    state root: 0xfbee2a32880323feccf7160693a8e25e305b584b189f75a15b3e4b72089abd09
    event root: 0x34946409117620dce2dc5538352ca2cfc47759ab58e96bea7417862cdd0a28e3

however, when publishing a build of rooch_framework, there is an error #3727.