Skip to content

Commit

Permalink
Merge branch 'Version-v12.3.0' into fix/23361-fix-signed-transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwalsh0 authored Sep 17, 2024
2 parents c088c9d + ad728f7 commit c0df32e
Show file tree
Hide file tree
Showing 19 changed files with 273 additions and 74 deletions.
10 changes: 0 additions & 10 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ npmAuditIgnoreAdvisories:
# not appear to be used.
- 1092461

# Issue: path-to-regexp outputs backtracking regular expressions
# URL: https://github.com/advisories/GHSA-9wv6-86v2-598j
# path-to-regexp is used in react-router v5.1.2, which we use. However, the
# vulnerability in path-to-regexp could only be exploited within react-router
# if malicious properties were passed to react-router components or methods
# explicitly from our code. As such, this vulneratibility cannot be exploited
# by an external / malicious actor. Meanwhile, once we update to v6+,
# path-to-regexp will no longer be used.
- 1099518

# Temp fix for https://github.com/MetaMask/metamask-extension/pull/16920 for the sake of 11.7.1 hotfix
# This will be removed in this ticket https://github.com/MetaMask/metamask-extension/issues/22299
- 'ts-custom-error (deprecation)'
Expand Down
6 changes: 3 additions & 3 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -5552,7 +5552,7 @@
"react-router-dom>react-router>mini-create-react-context": true,
"react-router-dom>tiny-invariant": true,
"react-router-dom>tiny-warning": true,
"sinon>nise>path-to-regexp": true
"serve-handler>path-to-regexp": true
}
},
"react-router-dom>react-router>history": {
Expand Down Expand Up @@ -5702,9 +5702,9 @@
"process": true
}
},
"sinon>nise>path-to-regexp": {
"serve-handler>path-to-regexp": {
"packages": {
"sinon>nise>path-to-regexp>isarray": true
"serve-handler>path-to-regexp>isarray": true
}
},
"stream-browserify": {
Expand Down
6 changes: 3 additions & 3 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -5552,7 +5552,7 @@
"react-router-dom>react-router>mini-create-react-context": true,
"react-router-dom>tiny-invariant": true,
"react-router-dom>tiny-warning": true,
"sinon>nise>path-to-regexp": true
"serve-handler>path-to-regexp": true
}
},
"react-router-dom>react-router>history": {
Expand Down Expand Up @@ -5702,9 +5702,9 @@
"process": true
}
},
"sinon>nise>path-to-regexp": {
"serve-handler>path-to-regexp": {
"packages": {
"sinon>nise>path-to-regexp>isarray": true
"serve-handler>path-to-regexp>isarray": true
}
},
"stream-browserify": {
Expand Down
6 changes: 3 additions & 3 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -5552,7 +5552,7 @@
"react-router-dom>react-router>mini-create-react-context": true,
"react-router-dom>tiny-invariant": true,
"react-router-dom>tiny-warning": true,
"sinon>nise>path-to-regexp": true
"serve-handler>path-to-regexp": true
}
},
"react-router-dom>react-router>history": {
Expand Down Expand Up @@ -5702,9 +5702,9 @@
"process": true
}
},
"sinon>nise>path-to-regexp": {
"serve-handler>path-to-regexp": {
"packages": {
"sinon>nise>path-to-regexp>isarray": true
"serve-handler>path-to-regexp>isarray": true
}
},
"stream-browserify": {
Expand Down
6 changes: 3 additions & 3 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -5620,7 +5620,7 @@
"react-router-dom>react-router>mini-create-react-context": true,
"react-router-dom>tiny-invariant": true,
"react-router-dom>tiny-warning": true,
"sinon>nise>path-to-regexp": true
"serve-handler>path-to-regexp": true
}
},
"react-router-dom>react-router>history": {
Expand Down Expand Up @@ -5770,9 +5770,9 @@
"process": true
}
},
"sinon>nise>path-to-regexp": {
"serve-handler>path-to-regexp": {
"packages": {
"sinon>nise>path-to-regexp>isarray": true
"serve-handler>path-to-regexp>isarray": true
}
},
"stream-browserify": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
"@metamask/keyring-controller@npm:^17.1.0": "patch:@metamask/keyring-controller@npm%3A17.1.1#~/.yarn/patches/@metamask-keyring-controller-npm-17.1.1-098cb41930.patch",
"@trezor/connect-web@npm:^9.1.11": "patch:@trezor/connect-web@npm%3A9.3.0#~/.yarn/patches/@trezor-connect-web-npm-9.3.0-040ab10d9a.patch",
"@metamask/transaction-controller@npm:^34.0.0": "patch:@metamask/transaction-controller@npm%3A34.0.0#~/.yarn/patches/@metamask-transaction-controller-npm-34.0.0-8bdfa87aaf.patch"
"path-to-regexp": "1.9.0"
},
"dependencies": {
"@babel/runtime": "patch:@babel/runtime@npm%3A7.24.0#~/.yarn/patches/@babel-runtime-npm-7.24.0-7eb1dd11a2.patch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export default function TurnOnMetamaskNotifications() {
);
const isProfileSyncingEnabled = useSelector(selectIsProfileSyncingEnabled);

const [buttonState, setButtonState] = useState<boolean>(
const [isLoading, setIsLoading] = useState<boolean>(
isUpdatingMetamaskNotifications,
);

const { createNotifications, error } = useCreateNotifications();

const handleTurnOnNotifications = async () => {
setButtonState(true);
setIsLoading(true);
await createNotifications();
trackEvent({
category: MetaMetricsEventCategory.NotificationsActivationFlow,
Expand All @@ -72,13 +72,18 @@ export default function TurnOnMetamaskNotifications() {

const handleHideModal = () => {
hideModal();
trackEvent({
category: MetaMetricsEventCategory.NotificationsActivationFlow,
event: MetaMetricsEventName.NotificationsActivated,
properties: {
is_profile_syncing_enabled: isProfileSyncingEnabled,
action_type: 'dismissed',
},
setIsLoading((prevLoadingState) => {
if (!prevLoadingState) {
trackEvent({
category: MetaMetricsEventCategory.NotificationsActivationFlow,
event: MetaMetricsEventName.NotificationsActivated,
properties: {
is_profile_syncing_enabled: isProfileSyncingEnabled,
action_type: 'dismissed',
},
});
}
return prevLoadingState;
});
};

Expand Down Expand Up @@ -149,8 +154,8 @@ export default function TurnOnMetamaskNotifications() {
}}
submitButtonProps={{
children: t('turnOnMetamaskNotificationsButton'),
loading: buttonState,
disabled: buttonState,
loading: isLoading,
disabled: isLoading,
'data-testid': 'turn-on-notifications-button',
}}
/>
Expand Down
18 changes: 18 additions & 0 deletions ui/components/app/name/__snapshots__/name.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,21 @@ exports[`Name renders address with saved name 1`] = `
</div>
</div>
`;

exports[`Name renders when no address value is passed 1`] = `
<div>
<div>
<div
class="name name__missing"
>
<span
class="mm-box name__icon mm-icon mm-icon--size-md mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/question.svg');"
/>
<p
class="mm-box mm-text name__value mm-text--body-md mm-box--color-text-default"
/>
</div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,188 @@ exports[`NameDetails renders proposed names 1`] = `
</body>
`;

exports[`NameDetails renders when no address value is passed 1`] = `
<body>
<div
id="popover-content"
/>
<div>
<div
class="mm-box"
/>
</div>
<div
class="mm-modal"
>
<div
aria-hidden="true"
class="mm-box mm-modal-overlay mm-box--width-full mm-box--height-full mm-box--background-color-overlay-default"
/>
<div
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="0"
/>
<div
data-focus-lock-disabled="false"
>
<div
class="mm-box mm-modal-content mm-box--padding-top-4 mm-box--sm:padding-top-8 mm-box--md:padding-top-12 mm-box--padding-right-4 mm-box--padding-bottom-4 mm-box--sm:padding-bottom-8 mm-box--md:padding-bottom-12 mm-box--padding-left-4 mm-box--display-flex mm-box--justify-content-center mm-box--align-items-flex-start mm-box--width-screen mm-box--height-screen"
>
<section
aria-modal="true"
class="mm-box mm-modal-content__dialog mm-modal-content__dialog--size-sm mm-box--padding-top-4 mm-box--padding-bottom-4 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full mm-box--background-color-background-default mm-box--rounded-lg"
role="dialog"
>
<header
class="mm-box mm-header-base mm-modal-header mm-box--padding-right-4 mm-box--padding-bottom-4 mm-box--padding-left-4 mm-box--display-flex mm-box--justify-content-space-between"
>
<div
class="mm-box mm-box--width-full"
>
<h4
class="mm-box mm-text mm-text--heading-sm mm-text--text-align-center mm-box--color-text-default"
>
Unknown address
</h4>
</div>
<div
class="mm-box mm-box--display-flex mm-box--justify-content-flex-end"
style="min-width: 0px;"
>
<button
aria-label="Close"
class="mm-box mm-button-icon mm-button-icon--size-sm mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-icon-default mm-box--background-color-transparent mm-box--rounded-lg"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/close.svg');"
/>
</button>
</div>
</header>
<div
class="mm-box mm-modal-body name-details__modal-body mm-box--padding-right-4 mm-box--padding-left-4"
>
<div
style="text-align: center; margin-bottom: 16px; margin-top: 8px;"
>
<div>
<div
class="name name__missing"
>
<span
class="mm-box name__icon mm-icon mm-icon--size-md mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/question.svg');"
/>
<p
class="mm-box mm-text name__value mm-text--body-md mm-box--color-text-default"
/>
</div>
</div>
</div>
<p
class="mm-box mm-text mm-text--body-md mm-box--margin-bottom-4 mm-box--justify-content-space-between mm-box--color-text-default"
>
If you know this address, give it a nickname to recognize it in the future.
</p>
<div
class="mm-box mm-form-text-field mm-form-text-field--disabled name-details__address mm-box--margin-bottom-4 mm-box--display-flex mm-box--flex-direction-column"
>
<label
class="mm-box mm-text mm-label mm-label--html-for mm-form-text-field__label mm-text--body-md mm-text--font-weight-medium mm-box--display-inline-flex mm-box--align-items-center mm-box--color-text-default"
for="address"
>
Address
</label>
<div
class="mm-box mm-text-field mm-text-field--size-md mm-text-field--disabled mm-text-field--truncate mm-form-text-field__text-field mm-box--padding-right-4 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--align-items-center mm-box--background-color-background-default mm-box--rounded-sm mm-box--border-width-1 box--border-style-solid"
>
<input
autocomplete="off"
class="mm-box mm-text mm-input mm-input--disable-state-styles mm-input--disabled mm-text-field__input mm-text--body-md mm-box--margin-0 mm-box--padding-0 mm-box--padding-right-2 mm-box--padding-left-4 mm-box--color-text-default mm-box--background-color-transparent mm-box--border-style-none"
disabled=""
focused="false"
id="address"
type="text"
value=""
/>
<button
aria-label="Copy address to clipboard"
class="mm-box mm-button-icon mm-button-icon--size-sm mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-icon-muted mm-box--background-color-transparent mm-box--rounded-lg"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/copy.svg');"
/>
</button>
</div>
</div>
<label
class="mm-box mm-text mm-label name-details__display-name mm-text--body-md mm-text--font-weight-medium mm-box--margin-bottom-2 mm-box--display-inline-flex mm-box--flex-direction-column mm-box--align-items-flex-start mm-box--color-text-default"
>
Nickname
<div
class="form-combo-field"
>
<div>
<div
class="box mm-form-text-field form-combo-field__value box--display-flex box--flex-direction-column"
>
<div
class="mm-box mm-text-field mm-text-field--size-md mm-text-field--focused mm-text-field--truncate mm-form-text-field__text-field mm-box--padding-right-4 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--align-items-center mm-box--background-color-background-default mm-box--rounded-sm mm-box--border-width-1 box--border-style-solid"
>
<input
autocomplete="off"
class="mm-box mm-text mm-input mm-input--disable-state-styles mm-text-field__input mm-text--body-md mm-box--margin-0 mm-box--padding-0 mm-box--padding-right-2 mm-box--padding-left-4 mm-box--color-text-default mm-box--background-color-transparent mm-box--border-style-none"
focused="true"
placeholder="Choose a nickname..."
type="text"
value=""
/>
<button
aria-label="Clear"
class="mm-box mm-button-icon mm-button-icon--size-sm mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-icon-muted mm-box--background-color-transparent mm-box--rounded-lg"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/close.svg');"
/>
</button>
</div>
</div>
</div>
</div>
</label>
</div>
<div
class="mm-box mm-modal-footer mm-box--padding-top-4 mm-box--padding-right-4 mm-box--padding-left-4"
>
<button
class="mm-box mm-text mm-button-base mm-button-base--size-lg mm-button-primary mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-4 mm-box--padding-left-4 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--width-full mm-box--color-primary-inverse mm-box--background-color-primary-default mm-box--rounded-pill"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--margin-inline-end-1 mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/save.svg');"
/>
Save
</button>
<div
class="mm-box mm-container mm-container--max-width-sm mm-box--margin-right-auto mm-box--margin-left-auto mm-box--display-flex mm-box--gap-4 mm-box--flex-wrap-wrap mm-box--align-items-center"
/>
</div>
</section>
</div>
</div>
<div
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="0"
/>
</div>
</body>
`;

exports[`NameDetails renders with no saved name 1`] = `
<body>
<div
Expand Down
13 changes: 13 additions & 0 deletions ui/components/app/name/name-details/name-details.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ describe('NameDetails', () => {
useDispatchMock.mockReturnValue(jest.fn());
});

it('renders when no address value is passed', () => {
const { baseElement } = renderWithProvider(
<NameDetails
type={NameType.ETHEREUM_ADDRESS}
value={''}
onClose={() => undefined}
/>,
store,
);

expect(baseElement).toMatchSnapshot();
});

it('renders with no saved name', () => {
const { baseElement } = renderWithProvider(
<NameDetails
Expand Down
Loading

0 comments on commit c0df32e

Please sign in to comment.