Skip to content

fix: Fix #24320: Prevent editing of safe-transfer-from transactions#24319

Merged
danjm merged 3 commits intodevelopfrom
fix-1
May 1, 2024
Merged

fix: Fix #24320: Prevent editing of safe-transfer-from transactions#24319
danjm merged 3 commits intodevelopfrom
fix-1

Conversation

@darkwing
Copy link
Copy Markdown
Contributor

@darkwing darkwing commented Apr 30, 2024

Description

Ensures that ERC1155s sends are no longer editable

Open in GitHub Codespaces

Related issues

Fixes: #24320

Manual testing steps

See issue for STRs

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

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.

@darkwing darkwing requested review from a team as code owners April 30, 2024 20:51
@github-actions
Copy link
Copy Markdown
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
Gudahtt previously approved these changes Apr 30, 2024
Copy link
Copy Markdown
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!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should follow up in a later PR to simplify this logic a bit (I think we can inline the remaining useful parts of showEdit here). There might be more dead code to remove as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should also follow up with e2e test coverage for any impacted types of transactions we can think of

@darkwing darkwing changed the title Fix 1 fix: Fix #24320: Prevent editing of safe-transfer-from transactions Apr 30, 2024
cryptotavares
cryptotavares previously approved these changes Apr 30, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.29%. Comparing base (d15626b) to head (f51a0e1).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #24319      +/-   ##
===========================================
+ Coverage    67.28%   67.29%   +0.01%     
===========================================
  Files         1275     1275              
  Lines        49707    49702       -5     
  Branches     12916    12916              
===========================================
  Hits         33444    33444              
+ Misses       16263    16258       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [f51a0e1]
Page Load Metrics (2386 ± 786 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7062416411957
domContentLoaded1094302412
load56532623861637786
domInteractive1094302412
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: -167 Bytes (-0.00%)
  • common: 0 Bytes (0.00%)

decimals={decimals}
image={tokenImage}
tokenAddress={tokenAddress}
onEdit={async ({ txData }) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually wait, it looks like this component assumes that onEdit is always passed in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Following the trail here: this is a non-required prop, passed into confirm-token-transaction-base. That component passes it to confirm-transaction-base (passed through the container untouched, to the component module).

It's called here:

We try to call this in handleEdit without checking that it's defined.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh but wait, we also set showEdit to false when onEdit is false, here:

showEdit={!isContractInteractionFromDapp && Boolean(onEdit)}

Super confusing how this is setup, but never mind, this should work as-is.

@danjm danjm merged commit 8638ba3 into develop May 1, 2024
@danjm danjm deleted the fix-1 branch May 1, 2024 13:22
@github-actions github-actions bot locked and limited conversation to collaborators May 1, 2024
@metamaskbot metamaskbot added release-11.17.0 release-11.14.4 Issue or pull request that will be included in release 11.14.4 and removed release-11.17.0 labels May 1, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Missing release label release-11.14.4 on PR. Adding release label release-11.14.4 on PR and removing other release labels(release-11.17.0), as PR was cherry-picked in branch 11.14.4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-11.14.4 Issue or pull request that will be included in release 11.14.4 team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Editing a safeTransferFrom transaction request converts it to a transferFrom

6 participants