metamask-extension
metamask-extension copied to clipboard
Restore frame-ancestors: none
Description
In #21765 I updated the CSP to allow frame-ancestors: self. I did this so that html documents hosted in the extension could be loaded in an iframe in the offscreen document. However this has unintended consequences that @weizman brought to my attention as he reviewed the whole of this work for MV3.
Frame-ancestors: none still allows for externally hosted pages to be added as iframes but disallows pages hosted internally to be loaded in iframes. So loading the ledger keyring iframe from the ledger library is still doable, as is loading all of the snaps iframes. The major change required was not to encapsulate each of the hardware wallets listeners in its own iframe. Considering that we are still just using the chrome runtime api to listen for updates in those iframes there was functionally no requirement to have each of these isolated. This new solution maintains all functionality and restores the frame-ancestors: none CSP.
Related issues
Fixes:
Manual testing steps
- run
yarn start:mv3
- Go to the test dapp
- Use the various methods with the hardware wallets at your disposal.
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [x] I've clearly explained what problem this PR is solving and how it is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [x] I’ve included tests if applicable
- [x] 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.
- [x] I’ve properly set the pull request status:
- [ ] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to "non-draft".
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.
Builds ready [6251b57]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (720 ± 12 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 76 | 114 | 92 | 8 | 4 |
domContentLoaded | 9 | 22 | 14 | 3 | 2 | ||
load | 690 | 766 | 720 | 24 | 12 | ||
domInteractive | 9 | 22 | 14 | 3 | 2 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [b6156e2]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1045 ± 41 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 130 | 222 | 188 | 25 | 12 |
domContentLoaded | 11 | 69 | 27 | 19 | 9 | ||
load | 970 | 1276 | 1045 | 85 | 41 | ||
domInteractive | 11 | 69 | 27 | 19 | 9 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [e22c965]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1118 ± 59 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 121 | 304 | 202 | 42 | 20 |
domContentLoaded | 12 | 112 | 33 | 27 | 13 | ||
load | 897 | 1337 | 1118 | 122 | 59 | ||
domInteractive | 12 | 112 | 33 | 27 | 13 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
030786a
) 68.47% compared to head (042d3c5
) 68.47%. Report is 3 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #22914 +/- ##
========================================
Coverage 68.47% 68.47%
========================================
Files 1089 1089
Lines 43026 43026
Branches 11459 11459
========================================
Hits 29459 29459
Misses 13567 13567
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [836a946]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1066 ± 45 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 119 | 286 | 180 | 49 | 24 |
domContentLoaded | 12 | 192 | 57 | 42 | 20 | ||
load | 934 | 1259 | 1066 | 95 | 45 | ||
domInteractive | 12 | 192 | 57 | 42 | 20 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [f4805ad]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (990 ± 26 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 133 | 272 | 191 | 32 | 15 |
domContentLoaded | 9 | 83 | 36 | 25 | 12 | ||
load | 848 | 1096 | 990 | 54 | 26 | ||
domInteractive | 9 | 83 | 36 | 25 | 12 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [042d3c5]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1038 ± 70 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 103 | 509 | 206 | 90 | 43 |
domContentLoaded | 9 | 135 | 38 | 32 | 15 | ||
load | 747 | 1523 | 1038 | 146 | 70 | ||
domInteractive | 9 | 135 | 38 | 32 | 15 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)