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

Pass excludedPermissions to SnapController #17321

Merged
merged 16 commits into from
Feb 15, 2023

Conversation

GuillaumeRx
Copy link
Contributor

@GuillaumeRx GuillaumeRx commented Jan 20, 2023

Create a record of excluded permission/endowments with their associated error messages and pass it to SnapController. This also checks for the MetaMask version and updates the relevant methods using those excluded permissions.

Fixes: MetaMask/snaps#1103 MetaMask/snaps#990

@GuillaumeRx GuillaumeRx requested a review from a team as a code owner January 20, 2023 15:41
@GuillaumeRx GuillaumeRx requested review from adonesky1 and removed request for a team January 20, 2023 15:41
@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.

@GuillaumeRx GuillaumeRx force-pushed the gr/pass-excluded-permissions branch 2 times, most recently from ee0312f to 548ad1e Compare January 23, 2023 15:43
@metamaskbot
Copy link
Collaborator

Builds ready [548ad1e]
Page Load Metrics (1294 ± 95 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1013711335627
domContentLoaded9971645129219895
load9971646129419895
domInteractive9971645129219895
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -2039 bytes
  • ui: 0 bytes
  • common: 0 bytes

@GuillaumeRx GuillaumeRx force-pushed the gr/pass-excluded-permissions branch from 548ad1e to 439a448 Compare January 23, 2023 17:17
@metamaskbot
Copy link
Collaborator

Builds ready [439a448]
Page Load Metrics (1372 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint952881343919
domContentLoaded10281747135018488
load10281825137220197
domInteractive10281747135018488
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -2039 bytes
  • ui: 0 bytes
  • common: 0 bytes

Base automatically changed from snaps-monorepo@0.28.0 to develop January 23, 2023 19:41
shared/constants/permissions.ts Outdated Show resolved Hide resolved
shared/constants/permissions.ts Outdated Show resolved Hide resolved
shared/constants/permissions.ts Outdated Show resolved Hide resolved
shared/constants/permissions.ts Outdated Show resolved Hide resolved
@metamaskbot
Copy link
Collaborator

Builds ready [d15007e]
Page Load Metrics (1287 ± 121 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint961691362411
domContentLoaded99918101267246118
load101718271287252121
domInteractive99918101267246118
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

shared/constants/flask/environment.js Outdated Show resolved Hide resolved
shared/constants/permissions.ts Outdated Show resolved Hide resolved
@metamaskbot
Copy link
Collaborator

Builds ready [413947d]
Page Load Metrics (1358 ± 109 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint99157124178
domContentLoaded98916881320218105
load106416951358227109
domInteractive98916881320218105
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

@metamaskbot
Copy link
Collaborator

Builds ready [d87186e]
Page Load Metrics (1310 ± 114 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint961721362110
domContentLoaded104619601275231111
load104719601310237114
domInteractive104619601275231111
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

@GuillaumeRx GuillaumeRx force-pushed the gr/pass-excluded-permissions branch from d87186e to d1da271 Compare January 31, 2023 17:42
@metamaskbot
Copy link
Collaborator

Builds ready [d1da271]
Page Load Metrics (1230 ± 111 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint89148107147
domContentLoaded91515561225225108
load91516011230231111
domInteractive91515561225225108
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

david0xd
david0xd previously approved these changes Jan 31, 2023
ritave
ritave previously requested changes Feb 7, 2023
Copy link
Contributor

@ritave ritave left a comment

Choose a reason for hiding this comment

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

Excluded permissions should not be checked during run-time, but be completely removed during build time using code fencing.

I know this quite a bit of additional work, but this dramatically increases security. If we have a bug in logic, currently a bad actor could still find an exploit to run those permissions in stable.

If there's no code for those permissions at all in the extension, no way to run them in the first place.

As a suggestion, the easiest place to remove them during build time might be the RPC methods and PermissionController set-up, and the list here be used for informational purposes in console logs.

@metamaskbot
Copy link
Collaborator

Builds ready [e5b1f9c]
Page Load Metrics (1212 ± 92 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint911781182211
domContentLoaded9781610119419694
load10001610121219392
domInteractive9781610119419694
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

@ritave ritave dismissed their stale review February 7, 2023 15:27

Dismissing due to code fencing being implemented

@GuillaumeRx GuillaumeRx force-pushed the gr/pass-excluded-permissions branch from 0bda6dc to 0de6123 Compare February 8, 2023 14:29
@metamaskbot
Copy link
Collaborator

Builds ready [0de6123]
Page Load Metrics (1388 ± 104 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1101921432311
domContentLoaded11601934136520699
load116019341388217104
domInteractive11601934136520699

shared/constants/permissions.ts Show resolved Hide resolved
@brad-decker
Copy link
Contributor

@GuillaumeRx @ritave should this be merged?

@GuillaumeRx GuillaumeRx merged commit ccde549 into develop Feb 15, 2023
@GuillaumeRx GuillaumeRx deleted the gr/pass-excluded-permissions branch February 15, 2023 10:09
@github-actions github-actions bot locked and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable endowment:long-running in stable Forbid snaps from requesting eth_accounts
7 participants