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

Add tokenId type validation in wallet_watchAsset middleware #19738

Merged
merged 4 commits into from
Jun 26, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Jun 23, 2023

@github-actions
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.

@Gudahtt
Copy link
Member

Gudahtt commented Jun 23, 2023

Looks great! Could use a unit test though

@socket-security
Copy link

New and updated dependency changes detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: @metamask/test-dapp@7.0.0

@adonesky1 adonesky1 force-pushed the add-watch-asset-type-validation branch from 254ba13 to f7efb6e Compare June 23, 2023 19:08
@adonesky1 adonesky1 changed the title add tokenId type validation in watchAsset middleware Add tokenId type validation in wallet_watchAsset middleware Jun 23, 2023
@adonesky1 adonesky1 force-pushed the add-watch-asset-type-validation branch from 6c0d11d to f7efb6e Compare June 23, 2023 19:40
@adonesky1 adonesky1 marked this pull request as ready for review June 23, 2023 19:41
@adonesky1 adonesky1 requested a review from a team as a code owner June 23, 2023 19:41
@adonesky1 adonesky1 requested a review from legobeat June 23, 2023 19:41
@adonesky1 adonesky1 force-pushed the add-watch-asset-type-validation branch from f7efb6e to 39bb1d0 Compare June 23, 2023 20:14
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

Gudahtt
Gudahtt previously approved these changes Jun 23, 2023
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

Edit: Whoops, forgot I approved this already, had it open in a duplicated tab that I hadn't refreshed.

@metamaskbot
Copy link
Collaborator

Builds ready [39bb1d0]
Page Load Metrics (1744 ± 98 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1152831724421
domContentLoaded15222254174420498
load15232254174420498
domInteractive15222254174420498
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 443 bytes
  • ui: 0 bytes
  • common: 0 bytes

if (
[ERC721, ERC1155].includes(type) &&
tokenId &&
typeof tokenId !== 'string'
Copy link
Contributor

Choose a reason for hiding this comment

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

this would allow

{
  "type": "ERC721",
  "asset": {
    "tokenId": 0
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Fixed here

Copy link
Contributor

@jiexi jiexi left a comment

Choose a reason for hiding this comment

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

LGTM

@metamaskbot
Copy link
Collaborator

Builds ready [b526799]
Page Load Metrics (1624 ± 103 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1051991503015
domContentLoaded135619391619209100
load135619401624215103
domInteractive135619391618209100
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 455 bytes
  • ui: 0 bytes
  • common: 0 bytes

@codecov
Copy link

codecov bot commented Jun 24, 2023

Codecov Report

Merging #19738 (b526799) into develop (fc2402d) will increase coverage by 0.02%.
The diff coverage is 60.00%.

@@             Coverage Diff             @@
##           develop   #19738      +/-   ##
===========================================
+ Coverage    69.83%   69.85%   +0.02%     
===========================================
  Files          980      980              
  Lines        36886    36897      +11     
  Branches      9890     9894       +4     
===========================================
+ Hits         25757    25772      +15     
+ Misses       11129    11125       -4     
Impacted Files Coverage Δ
.../lib/rpc-method-middleware/handlers/watch-asset.js 77.78% <60.00%> (+40.28%) ⬆️

@adonesky1 adonesky1 merged commit e7e55dd into develop Jun 26, 2023
@adonesky1 adonesky1 deleted the add-watch-asset-type-validation branch June 26, 2023 14:12
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2023
@metamaskbot metamaskbot added the release-10.34.0 Issue or pull request that will be included in release 10.34.0 label Jun 26, 2023
@danjm danjm added release-blocker This bug is blocking the next release release-10.33.0 Issue or pull request that will be included in release 10.33.0 and removed release-10.34.0 Issue or pull request that will be included in release 10.34.0 labels Jun 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-10.33.0 Issue or pull request that will be included in release 10.33.0 release-blocker This bug is blocking the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants