-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Render personal_sign messages as utf-8 text #1177
Conversation
Calls to `personal_sign` are now: - When hex encoded, preserved as hex encoded, but displayed as utf-8 text. - When not hex encoded, decoded as utf-8 text as hex for signing. - The messages proposed for signing are displayed as UTF-8 text. - When the message cannot be rendered as UTF-8 text, it is displayed as hexadecimal. Fixes #1173
I think we should hard fail here, as hex encoding is a valid utf8 encoding |
Sample exception: |
What would a hard fail look like here? Throw an error to the sign request, and not show it to the user? |
throw an error to the sign request |
One example of unexpected behavior would be signing a number (e.g. a unix timestamp) -- in this implementation it would be interpreted as hex instead of utf8 |
The old The safest move would maybe be to only allow hex input, try to decode it, but fall back to the original input. |
@@ -21,6 +22,7 @@ PendingMsgDetails.prototype.render = function () { | |||
var account = state.accounts[address] || { address: address } | |||
|
|||
var { data } = msgParams | |||
console.dir({ msgParams }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz remove
this isnt safe if the developer is expecting the fallback case but (accidently) ends up with valid hex |
This is what MIME types are for, and what I was originally postponing this feature for. Maybe we should just wait for that, I don't see a correct way forward here. |
my philosophy here is: |
I look forward to the MIME type spec - but that feature actually happens "after" this intial decoding we are dealing with the first layer of this stack:
|
…ask-plugin into i1173-ShowPersonalMessage
In many cases, a timestamp will be included in the message to be signed to prevent replay attacks. The timestamp is not necessarily something we want to display to the user though - yet this scheme would do so. I would love to be able to pass a "display string" that is presented to the user in the confirmation window to help guide them through the process. For example "Please press "Confirm" if you would like to do X". We can make the actual message available to the user for inspection if they so desire, but it may not be meaningful to them |
I think mime content headers would adequately allow specifying portions of the signed text to render vs to hide: #925 |
Calls to
personal_sign
are now:Fixes #1173