Skip to content
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

Enable raw payloads to be signed in extension #1358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

S0c5
Copy link

@S0c5 S0c5 commented May 2, 2024

this PR closes #1357 by adding a type 'raw' signature that enables developers to sign raw payloads using the 'signRaw' method in the extension and avoid forced data manipulation in the signing process.

…pes and use u8aToU8a for raw data before signing
Copy link
Contributor

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What prevents from letting users sign a TX without showing them they are signing a TX?

What prevents you from wrapping your payload with <bytes></bytes> which is easy enough ?

This is a security measure that should not be removed. Also it's been there for long enough that changing this behavior would actually break Dapps :)

@S0c5
Copy link
Author

S0c5 commented May 2, 2024

@Tbaut thanks for such a quick response!!!

What prevents them from letting users sign a TX without showing them they are signing a TX?

I suggest a change in the UI that warns clearly and directly to users that they're about to perform a low-level operation with an unknown consequence, something:

"STOP THERE: You are about to sign an unknown transaction. Make sure you trust the source, as it could potentially drain all your funds."

what do you think?

What prevents you from wrapping your payload with which is easy enough ?

Given I'm crafting a raw substrate transaction with a custom tool called https://github.com/virto-network/virto-sdk/tree/main/sube and using a cross-platform signing library called lib wallet (https://github.com/virto-network/virto-sdk/tree/main/libwallet) which one of the backends we're developing is Polkadot js, we need to sign raw payloads in order to complete the operation and avoid the BadProof error when submiting.

@Tbaut
Copy link
Contributor

Tbaut commented May 3, 2024

The security issue is about having a malicious Dapp. Having a warning on the Dapp doesn't make sense, if it's malicious there'll obviously be no warning.

To sign in to some websites, e.g Polkassembly, they let users sign a non legible random number. This is bad practice and they should let them sign some text containing a random number, but that's what they do. Say Polkassembly is hacked tomorrow and instead of a random number, it's a substrate TX that transfers all the user funds to the attacker. Well users will blind sign, because the extension won't try to decode the TX since it's a raw signing. It is absolutely essential to differenciate raw signing from transaction signing.

Regarding your use case, I don't get why you need raw signing. Why don't you let users sign the TX as a TX?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants