deroproject / derohe

DERO Homomorphic Encryption Blockchain Protocol
Other
208 stars 82 forks source link

XSWD permission changes and tests #176

Open SixofClubsss opened 6 months ago

SixofClubsss commented 6 months ago

Description

XSWD permission changes and further enhancements to the XSWD protocol.

dApps can submit permissions to perform requests with their ApplicationData when they initially connect to the wallet. If these permissions are unknowingly accepted by the wallet user when connection is made the wallet may not receive any further prompts for this dApps requests due to requestPermission() returning any stored permission.

https://github.com/deroproject/derohe/blob/bd300c0e086e13ca9a1279ec47c5cade7d5996c7/walletapi/xswd/xswd.go#L604

Proposed solutions to address this:

Further enhancements

Type of change

Which part is impacted ?

Checklist:

License

Im am contributing & releasing the code under DERO Research License (which can be found here).

Slixe commented 6 months ago

looks cool! thanks

But, I was waiting on Captain to have another signature function to implement it for permissions because:

During a previous connection he could be able to request SignData method, sign its application ID and then reconnect to inject permissions.

The initial plan was that signature is based on AppID + permissions map, so permissions are reviewed before being signed for this application. Here he can set any permission he want as long the user signed the appID.

lmk what you think

SixofClubsss commented 6 months ago

Thanks for the feedback. Sounds like you had some similar thoughts on the topic of permissions and signatures.

SignData would be accessible as a XSWD request yes. It is permissoned so that the wallet user can choose to accept or deny the request. Attempting unauthorized SignData requests are in the package tests. https://github.com/civilware/derohe/blob/ef4cd10335bc798c9d1d28450f635dc9578b7a2b/walletapi/xswd/xswd_test.go#L489 https://github.com/civilware/derohe/blob/ef4cd10335bc798c9d1d28450f635dc9578b7a2b/walletapi/xswd/xswd_test.go#L913

Application ID is selected by dApp yes. When using software contained within this PR, if a dApp did as described and requested a signature which the user then chose to accept, and then dApp proceeds to reconnect using that signature. No permissions would be applied upon connection as the wallets uses the added forceAsk param set to true. Package tests are looking for unauthorized permissions when forceAsk is true. https://github.com/civilware/derohe/blob/ef4cd10335bc798c9d1d28450f635dc9578b7a2b/walletapi/xswd/xswd_test.go#L539