Encode entity type into delegation signature #475

Closed
opened 2023-07-24 23:26:27 +09:00 by davidyuk · 1 comment
davidyuk commented 2023-07-24 23:26:27 +09:00 (Migrated from gitlab.com)

I've found 3 types of delegation signatures:

  1. network id + account address + contract address -- delegate AENS and Oracle operations
  2. network id + account address + name hash + contract address -- delegate an AENS name to a contract
  3. network id + query id + contract address -- delegate ability to reply to an oracle query

The addresses and ids are encoded as raw data, losing information on the entity type. In existing combinations, I can re-encode the current account address as an oracle query id and request the wallet to sign an oracle query delegation (3) and get a general delegation (1) instead.

If later we would introduce additional delegation signatures like network id + account address + channel address + contract address then functions signing a delegation of a new type can be misused to generate name delegation (2).

Currently, implementing a wallet API the correct way to name methods would be "sign network id, account address, and 32 bytes" instead of "sign network id, account address, and contract address".

The above issues may be solved by encoding address the same way as in transactions, using this mapping https://github.com/aeternity/aeserialization/blob/177bf604b2a05e940f92cf00e96e6e269e708245/src/aeser_id.erl#L97-L102

I've found 3 types of delegation signatures: 1. `network id + account address + contract address` -- delegate AENS and Oracle operations 2. `network id + account address + name hash + contract address` -- delegate an AENS name to a contract 3. `network id + query id + contract address` -- delegate ability to reply to an oracle query The addresses and ids are encoded as raw data, losing information on the entity type. In existing combinations, I can re-encode the current account address as an oracle query id and request the wallet to sign an oracle query delegation (3) and get a general delegation (1) instead. If later we would introduce additional delegation signatures like `network id + account address + channel address + contract address` then functions signing a delegation of a new type can be misused to generate name delegation (2). Currently, implementing a wallet API the correct way to name methods would be "sign network id, account address, and 32 bytes" instead of "sign network id, account address, and contract address". The above issues may be solved by encoding address the same way as in transactions, using this mapping https://github.com/aeternity/aeserialization/blob/177bf604b2a05e940f92cf00e96e6e269e708245/src/aeser_id.erl#L97-L102
zxq9 commented 2023-08-03 17:43:22 +09:00 (Migrated from gitlab.com)

Created by: hanssv

Again, good observation!
... and again - nothing really to do with the Sophia compiler.

*Created by: hanssv* Again, good observation! ... and again - nothing really to do with the Sophia compiler.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: QPQ-AG/sophia#475