1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
Commit Graph

134 Commits

Author SHA1 Message Date
Frederik Bolding
910b9e713f
Use separate versions for Flask and Stable snaps (#18875)
* Use separate versions for Flask and Stable snaps

* Update LM policy override

* Add deps to depcheck

* Improve import
2023-05-03 15:16:43 +02:00
legobeat
ef01dc1391
Unbreak CI checks (#18813)
* Fix builds from forks
* bump coverage targets

---------

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
2023-04-26 20:14:33 +09:00
Frederik Bolding
086b7dade5
Improve logging at build-time (#18780)
* Improve logging at build-time

* Fix lint
2023-04-25 20:33:36 -10:00
Olaf Tomalka
95c37e1ba3
feat: add yaml feature management (#18125)
* feat: add yaml feature management

Add yaml feature file per build type.
Also add method to parse yaml and set
enabled features env to true. The build
process will then replace any process.env[feature]
that exists on the config by its value

* chore: add example for desktop

* Added initial draft of build features

* [TMP] Sync between computers

* Is able to succesfully build stable extension with snaps feature

* Removing var context from builds.yml

* Add asssets to builds.yml

* Minor bug fixes and removing debug logs

* [WIP] Test changes

* Removed TODOs

* Fix regession bug

Also
* remove debug logs
* merge Variables.set and Variables.setMany with an overload

* Fix build, lint and a bunch of issues

* Update LavaMoat policies

* Re-add desktop build type

* Fix some tests

* Fix desktop build

* Define some env variables used by MV3

* Fix lint

* Fix remove-fenced-code tests

* Fix README typo

* Move new code

* Fix missing asset copy

* Move Jest env setup

* Fix path for test after rebase

* Fix code fences

* Fix fencing and LavaMoat policies

* Fix MMI code-fencing after rebase

* Fix MMI code fencing after merge

* Fix more MMI code fencing

---------

Co-authored-by: cryptotavares <joao.tavares@consensys.net>
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2023-04-25 16:32:51 +02:00
Frederik Bolding
b9b1b19174
Stop transpiling ES2020 libraries (#18713) 2023-04-21 14:18:15 +02:00
Mark Stacey
3776f4ad4c
Remove mobile sync feature (#18692)
The mobile sync feature has been removed. It has been disabled for
years. When we enable sync again, it will be using a different
implementation. This has already been removed on the mobile side.
2023-04-20 14:29:30 -02:30
Mark Stacey
ac64cc9e38
Fix Sentry console logs (#18539)
Sentry console logs were failing with the error "Error: TypeError:
Cannot read properties of undefined (reading 'log')". This error has
been fixed; now Sentry can log errors to the console.

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2023-04-19 14:27:02 -02:30
Dan J Miller
7a8d0273a0
Don't include document in scuttling config for mv3 builds (#18356)
* Don't include document in scuttling config for mv3 builds

* Fix env var comparison

* lint fix
2023-04-04 12:45:50 -02:30
David Walsh
c079c4320e
UX: Multichain: Account Menu List (#17947)
* UX: Multichain: Account Menu List

* Move to using stylesheet

* Add hover state

* Implement George's suggestions

* Add connected site avatar

* Add hardware tag

* Create story for selected hardware item

* Progress on the AccountListItemMenu

* Add story for AccountListItemMenu

* Better position the account menu

* Fix AvatarFavicon missing name prop

* Update menu options label to be account specific

* Update text of 'View on Explorer'

* Add AccountListMenu component

* Move all items to multichain directory

* Fix paths

* Fix linting, use AvatarIcon

* Add title and close button to account menu

* Center the popover title

* Add search functionality

* Implementation WIP

* Add MULTICHAIN feature flag

* Add MULTICHAIN feature flag, add actions for menu items

* Properly dispatch events

* Fix search box padding

* Fix sizing of menu item text

* Fix isRequired

* Fix alignment of the popover

* Update label for hardware wallet items, add text for no search results

* Update keyring retreival to remove account and add label

* Fix storybook

* Fix double link click issue, prevent wrapping of values

* Use labelProps for tag variant

* Restructure item menu story

* Empower storybooks for all new components

* Allow only 3 decimals for currencies

* Avoid inline styles

* Prefix classes with multichain, fix account-list-menu storybook

* Close the accounts menu when account details is clicked

* Restore tag.js

* Create global file for multichain css

* Add index file for multichain js

* Update file paths

* Ensure the block domain is present in menu

* Add AccountListItem test

* Add AccountListItemMenu tests

* Show account connect to current dapp

* Improve tests

* Make avatar smaller

* Add tooltip for account menu

* Align icon better

* Update snapshot

* Rename files to DS standard

* Add index files for export

* Export all multichain components

* Update snapshot

* Remove embedded style in popover

* Add comments for props, cleanup storybook

* Improve test coverage

* Improve test code quality

* Remove border form avatar

* Switch to using the ButtonLink iconName prop

* Only show tooltip if character limit is reached

* Restore prior search settings

* Add test for tooltip
2023-03-22 15:30:08 +05:30
Frederik Bolding
872a8c79f4
Bump @metamask/utils to 5.0.0 (#18155)
* Update utils

* Ignore as-sha256

* Update LavaMoat policies
2023-03-16 11:33:40 +01:00
David Walsh
5b1b5dc03b
NFTs: Remove feature flag for release (#17401)
* NFTs: Remove feature flag for release

* Update security tab jest test

* Fix broken test

* Update snapshot

* Update test

* Fix test

* Remove last usages of flag

* Update CI jobs

* Fix jest tests
2023-03-13 14:29:37 -05:00
Albert Olivé
cd26ad001a
[MMI] Conditional change title in home if buildType is MMI (#17898)
Co-authored-by: António Regadas <apregadas@gmail.com>
2023-03-02 10:18:46 -06:00
António Regadas
56cba09749
[MMI] Adds mmi build type + manifest files and images (#17842)
* MMI adds all mmi images, build type and manifest files

* build-for-all-custodians

* fix remove-fenced-code test

* no need for axios

* runs prettier

* linter

* MMI moving file out of codebase

* MMI adds locale appNameMmi

* MMI adds locale appNameMmi to verify-locale-strings
2023-03-01 09:38:15 +00:00
Matthew Walsh
cc99a25228
Add desktop support (#17683)
Use DesktopManager in background script to redirect internal and external connections to the desktop app.
Include DesktopController in the MetaMask controller.
Support desktop keyrings in MetaMask controller via the overrides object.
Create middleware handler to connect to the desktop app while UI code is pending.
Add build system support for desktop specific configuration variables.
2023-02-20 17:13:12 +00:00
Sam Gbafa
7aad1c9650
remove siwe feature flag (#17690)
Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
2023-02-10 02:05:16 +07:00
weizman
4a57d994c7
Activate LavaMoat scuttling security feature (#17276) 2023-01-24 19:00:35 +02:00
Mark Stacey
cb12cb8f5a
Restore support for Chromium v78 (#17251)
Support has been restored for Chromium v78. Previously the extension
would crash upon startup.

The main incompatibility was the use of ES2020 operators (the optional
chain and nullish coalesce operators) in the libraries
 `@ethereumjs/util` and `superstruct`. This was resolved by transpiling
those libraries.

After fixing that, the extension no longer crashed but the UI refused
to connect. This was because the UI process was not being identified as
an internal process, because the code responsible for checking that was
relying on the `origin` property of `MessageSender` [1] which wasn't
added until Chromium v80. The check has been updated to use the `url`
property instead, which existed in older versions of Chrome.

Lastly, the content security policy was updated to include the default
content security policy alongside the intended modification. Newer
versions of Chrome will merge the configired CSP with the default, but
older versions required it to be explicitly specified. This should not
result in any functional change.

[1]: https://developer.chrome.com/docs/extensions/reference/runtime/#type-MessageSender
2023-01-23 12:36:48 -03:30
David Walsh
7760f4d658
Remove ONBOARDING_V2 flag for release (#16865)
* Remove ONBOARDING_V2 flag for release

* Remove new usage

* Update e2e tests

* Update incremental-security.spec.js

* Fix lint

Co-authored-by: PeterYinusa <peter.yinusa@consensys.net>
2023-01-13 10:25:01 -06:00
weizman
3cf5ef642f
Revert "Integrate new LavaMoat scuttling protection feature (#16994)" (#17043) 2022-12-22 17:26:53 +02:00
weizman
5d320ceec6
Integrate new LavaMoat scuttling protection feature (#16994)
Co-authored-by: kumavis <kumavis@users.noreply.github.com>
Co-authored-by: kumavis <aaron@kumavis.me>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2022-12-21 12:54:30 -06:00
David Walsh
7d3b1d08da
NFTs: Update COLLECTIBLES_V1 to NFTS_V1 (#16851) 2022-12-08 11:37:47 -06:00
Filip Sekulic
c3f329cc80
Transaction security provider feature flag (#16776) 2022-12-06 11:43:53 -03:00
HowardBraham
b1fd7f7796
Fixes 'yarn start' on Windows - LavaPack is not defined (#13318) (#16550)
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2022-11-30 09:19:45 -06:00
Mark Stacey
7279ea5b40
Use current version of the phishing warning page (#16123)
We now use the `latest` tag for the phishing warning page, we now use
the version that matches what we have in our manifest. This ensures
that our phishing warning e2e tests match the behaviour of the
production build, and it ensures that breaking changes to the phishing
warning page don't impact users in production.
2022-10-07 14:19:20 -02:30
Harry
21c9fe2de9
Change endpoint to always use latest build of the phishing warning (#16026)
Co-authored-by: ryanml <ryanlanese@gmail.com>
2022-09-28 22:38:23 -07:00
George Marshall
e69e207b7d
Adding Icon component and removing BaseIcon component (#15772)
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2022-09-20 12:15:14 -05:00
Mark Stacey
5bfc2f379d
Fix portfolio URL configuration (#15849)
The portfolio URL added in #15407 was meant to be configurable via
environment variable or the `.metamaskrc` file, but that configuration
was broken. Instead the default value was always used.

That configuration has been fixed. The portfolio URL can be set either
by environment variable or configuration file.
2022-09-16 10:43:59 -02:30
Matthew Epps
dcfe80c255
Add entry point for metalabs dapp into metamask home page (#15407)
Co-authored-by: Dan Miller <danjm.com@gmail.com>
2022-09-13 08:41:58 -05:00
Filip Sekulic
47d61c6832
Token allowance improvements feature flag (#15646) 2022-08-24 11:04:36 -05:00
Mark Stacey
48c02ef641
Add validation to production build script (#15468)
Validation has been added to the build script when the "prod" target is
selected. We now ensure that all expected environment variables are
set, and that no extra environment variables are present (which might
indicate that the wrong configuration file is being used).

The `prod` target uses a new `.metamaskprodrc` configuration file. Each
required variable can be specified either via environment variable or
via this config file. CI will continue set these via environment
variable, but for local manual builds we can use the config file to
simplify the build process and ensure consistency.

A new "dist" target has been added to preserve the ability to build a
"production-like" build without this validation.

The config validation is invoked early in the script, in the CLI
argument parsing step, so that it would fail more quickly. Otherwise
we'd have to wait a few minutes longer for the validation to run.
This required some refactoring, moving functions to the utility module
and moving the config to a dedicated module.

Additionally, support has been added for all environment variables to
be set via the config file. Previously the values `PUBNUB_PUB_KEY`,
`PUBNUB_SUB_KEY`, `SENTRY_DSN`, and `SWAPS_USE_DEV_APIS` could only be
set via environment variable. Now, all of these variables can be set
either way.

Closes #15003
2022-08-19 15:46:18 -02:30
Niranjana Binoy
650eac88a5
Cleanup after TOKEN_DETECTION_V2 flag removal (#15564) 2022-08-16 10:22:05 -04:00
Mark Stacey
e3420a4262
Fix build script errors (#15493)
There is a SES bug that results in errors being printed to the console
as `{}`[1]. The known workaround is to print the error stack rather
than printing the error directly. This affects our build script when it
is run with LavaMoat.

We used this workaround in one place in the build script already, but
not in the handler for task errors. We now use it in both places.

The workaround has been moved to a function that we can use throughout
the build script.

[1]: https://github.com/endojs/endo/issues/944
2022-08-06 03:33:35 -04:00
Mark Stacey
44f8e9e10e
Replace rc with ini (#15464)
We use the `rc` package to read the `.metamaskrc` configuration file,
which is in "ini" format. This package has been replaced by the `ini`
package.

The `rc` package was not actively maintained, and it has had recent
security vulnerabilities. But most importantly, the config object
returned by `rc` includes a bunch of extra information that made build
script validation [1] difficult to implement. Specifically, it made it
challenging to ensure no extra environment variables were present.

The `ini` package on the other hand is simple, well maintained, and
is simpler to use. This package doesn't add any extra properties to the
object it returns, making validation easy.

[1]: https://github.com/MetaMask/metamask-extension/issues/15003
2022-08-05 15:11:18 -02:30
Mark Stacey
fa336b5137
Refactor build script to include build target (#15447)
The "scripts" portion of the build script has been refactored to pass
the "build target" throughout the file. The "build target" is the
target environment for the build, reflected by the command used to
start the build (e.g. "dev", "prod", "test", or "testDev").

Beforehand we derived the variables `devMode` and `testing` from this
build target, and passed these throughout the script. However, there is
a future change [1] that requires adding a new build target that acts
like "prod" in some ways but not others. It was easier to refactor to
pass through `buildTarget` directly than it was to add a _third_
boolean flag to indirectly represent the target.

The existence of the "testDev" target made it convenient to still have
the `testing` and `devMode` flag, so helper functions were added to
derive those values from the build target. I anticipate that these will
only be needed temporarily though. We will probably be able to get rid
of the `testDev` target and the related complexities when we start
adding more flags (like `--watch`[2] and `--minify`[3]) to the build
script directly.

[1]: https://github.com/MetaMask/metamask-extension/issues/15003
[2]: https://github.com/MetaMask/metamask-extension/issues/12767
[3]: https://github.com/MetaMask/metamask-extension/issues/12768
2022-08-04 15:42:06 -02:30
Mark Stacey
3b30984ce5
Fix "app-init" injection (#15320)
* Fix "app-init" injection

The way we were injecting variables into the `app-init.js` bundle was
accidentally overwriting the bundle output with the raw `app-init.js`
source file. This is a problem because the bundling process handles a
lot of things we care about like source maps, polyfills and other
necessary Babel transformations, environment variable injection, and
minification.

Instead of using string replacement to inject variables, we are now
using environment variables. The old string replacement strategy has
been removed, and the `app-init.js` module is now generated using the
same process as our other bundles.

A new option, "extraEnvironmentVariables", was added to allow us to
inject environment variables specifically for this bundle.

* Add check to ensure APPLY_LAVAMOAT is set
2022-08-03 12:51:10 -02:30
Sam Gbafa
5802805597
Add Sign-In with Ethereum (#14438)
Co-authored-by: Gregório Granado Magalhães <greg.magalhaes@gmail.com>
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
Co-authored-by: brad-decker <bhdecker84@gmail.com>
2022-08-03 09:56:11 -05:00
Brad Decker
693a6dfc0c
Remove unnecessary file extensions (#15352) 2022-07-27 14:32:17 -05:00
Mark Stacey
73cd2b0306
Add comments to build script (#15319)
This is a follow-up to #15318, which fixed a problem with environment
variables. Every function in this module that passes options related to
environment variables has been updated with a doc comment. This should
make it clearer which options are mandatory and which are optional,
hopefully preventing a similar mistake from happening in the future.
2022-07-27 13:04:02 -02:30
Brad Decker
1db0ee87ec
Update Eslint and deps (#15293) 2022-07-26 13:10:51 -05:00
Mark Stacey
2bcc1c512c
Fix environment variable injection (#15318)
The environment variables `IN_TEST` and `METAMASK_DEBUG` were not
being set to `false` correctly. Instead those variables were being
skipped, and were resolved to `undefined` at runtime. This is confusing
because the other environment variables do not work that way - they can
be set to false.

The build script has been updated to ensure those two environment
variables are always set to `true` or `false` - never `undefined`.

Additionally, the `METAMASK_VERSION` environment variable was being
omitted from the `app-init.js` bundle. For the sake of consistency,
that has also been restored.
2022-07-22 12:37:39 -02:30
Mark Stacey
4c942aa008
Rename various build script functions (#15317)
Some of the functions in `development/build/scripts.js` have been
renamed to better describe their function, and to be more consistent
with other similar functions.
2022-07-21 21:03:28 -02:30
Mark Stacey
61783bbe89
Remove unused bundling options in build script (#15316)
Two unused options have been removed from the `createNormalBundle`
function in the build script: 'extraEntries` and `modulesToExpose`.'

Both of these options were used in the old "main" bundles, before we
began using the "factored" bundles. They have been unused since #11080.
2022-07-21 21:03:06 -02:30
Jyoti Puri
0622883a3c
Capturing load time stats (#15157) 2022-07-20 11:40:31 +04:00
Jyoti Puri
6aa0ecce2a
Capturing lavamoat stats in E2E (#15153) 2022-07-20 03:07:15 +04:00
ryanml
959a376347
Remove 'ADD_POPULAR_NETWORKS' feature flag (#15229) 2022-07-14 08:58:34 -07:00
Jyoti Puri
aeb0147846
Adding tasks for MV3 test build (#15133) 2022-07-14 03:34:33 +04:00
Dan J Miller
e8ea973f0f
Add feature flag to prevent add popular networks from being available on prod (#15117) 2022-07-04 12:20:37 -02:30
Jyoti Puri
843beb6d20
MV3: fix injection of applyLavamoat variable in service worker (#14920) 2022-06-18 12:40:30 +05:30
Jyoti Puri
d8e1961fd1
MV3: Fix dynamic file list injection on service worker reload (#14795) 2022-06-15 20:27:51 +05:30
Mark Stacey
e6d5af5f9a Merge remote-tracking branch 'origin/develop' into master-sync
* origin/develop: (131 commits)
  Update `protobufjs` and remove obsolete advisory exclusion (#14841)
  Include snap version in pill (#14803)
  Update PULL_REQUEST_TEMPLATE.md (#14790)
  fix: keystone transaction qrcode has no white spacing (#14798)
  Snap notifications integration (#14605)
  Upgrade @metamask/eth-ledger-bridge-keyring (#14799)
  snaps-skunkworks@0.15.0 (#14772)
  Fix proptype errors in network dropdown, tx list item details, and account details modal tests (#14747)
  Ensure transaction type is correctly updated on edit (#14721)
  Add fiat onboarding for AVAX and MATIC through Wyre (#14683)
  Bump @metamask/contract-metadata from 1.33.0 to 1.35.0 (#14791)
  Slight cleanup of constants/transactions, useTransactionDisplayData, and TransactionIcon (#14784)
  Migrate the "estimateGas" API call to "getFees" for STX (#14767)
  Ignore advisory GHSA-wm7h-9275-46v2 (#14789)
  Adding flag for MV3 (#14762)
  Add types to send state (#14740)
  Remove site origin on snap install (#14752)
  Update design tokens library from 1.5 to 1.6 WIP (#14732)
  Enables the "Safe Transaction From" copy for safeTransferFrom transactions (#14769)
  remove draft transaction (#14701)
  ...
2022-06-03 11:53:40 -02:30