Skip to content

fix: personal sign message - decode message to UTF-8 string only if it is valid UTF-8 #29232

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

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

jpuri
Copy link
Contributor

@jpuri jpuri commented Dec 16, 2024

Description

Converts personal sign message to UTF-8 string only if it can be converted to valid UTF-8 string.

Related issues

Fixes: #3931

Manual testing steps

  1. Send personal sign request to extension with message string 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
  2. Check on confirmation page that it is displayed as UTF-8 string

Screenshots/Recordings

Screenshot 2024-12-16 at 6 53 30 PM

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@jpuri jpuri added the team-confirmations Push issues to confirmations team label Dec 16, 2024
@jpuri jpuri requested a review from a team as a code owner December 16, 2024 13:24
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

Builds ready [439de89]
Page Load Metrics (1636 ± 50 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint31518191566303145
domContentLoaded14171817160910651
load14361823163610550
domInteractive22107422512
backgroundConnect86230199
firstReactRender1684412512
getState55313147
initialActions01000
loadScripts979132911869043
setupStore65611115
uiStartup16222046185511053
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 314 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@jpuri jpuri enabled auto-merge December 16, 2024 14:45
it('returns true for valid UTF-8 string', () => {
expect(isValidUTF8('Hello')).toEqual(true);
expect(isValidUTF8('\xC3\x28')).toEqual(true);
expect(isValidUTF8('😀')).toEqual(true);
Copy link
Member

Choose a reason for hiding this comment

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

Minor, is it possible to include false cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep I will include it in following PR

@jpuri jpuri added this pull request to the merge queue Dec 19, 2024
auto-merge was automatically disabled December 19, 2024 11:37

Pull Request is not mergeable

Merged via the queue into main with commit a1b41c4 Dec 19, 2024
77 checks passed
@jpuri jpuri deleted the personal_sign_fix branch December 19, 2024 11:43
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2024
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Showing clearer data in the personal_sign signature
4 participants