1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Sign in with Ethereum: re-enable warning UI for mismatched domains / disable domain binding (#18200)

* siwe: re-enable warning UI for mismatched domains
- unblocks mismatched domain support
- we may re-add error handling here #18184
- reverts logic from #16616

* siwe: fix mismatch domain warning msg UI

* lint: rm whitespace EOL

* siwe: rm unit test

* lint: fix whitespace

* Revert "siwe: rm unit test"

This reverts commit c80a4a2e661609c46c76d1e43e05909b6db3f0f5.

---------

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
This commit is contained in:
Ariella Vu 2023-03-17 10:36:20 -07:00 committed by GitHub
parent 2a562087f9
commit c4caef5e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 24 deletions

View File

@ -153,15 +153,6 @@ export default class PersonalMessageManager extends EventEmitter {
const siwe = detectSIWE(msgParams);
msgParams.siwe = siwe;
if (siwe.isSIWEMessage && req.origin) {
const { host } = new URL(req.origin);
if (siwe.parsedMessage.domain !== host) {
throw new Error(
`SIWE domain is not valid: "${host}" !== "${siwe.parsedMessage.domain}"`,
);
}
}
// create txData obj with parameters and meta data
const time = new Date().getTime();
const msgId = createId();

View File

@ -178,15 +178,5 @@ describe('Personal Message Manager', () => {
const result2 = messageManager.getMsg(msgId2);
expect(result2.msgParams.siwe.isSIWEMessage).toStrictEqual(false);
});
it("should throw an error if the SIWE message's domain doesn't match", async () => {
const request = { origin: 'https://mismatched-domain.com' };
const { host: siweDomain } = new URL(origin);
const { host: browserDomain } = new URL(request.origin);
const expectedError = `SIWE domain is not valid: "${browserDomain}" !== "${siweDomain}"`;
await expect(async () => {
await messageManager.addUnapprovedMessage(msgParams, request);
}).rejects.toThrow(expectedError);
});
});
});

View File

@ -21,18 +21,25 @@
box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.08);
}
/** @todo replace ActionableMessage or remove overwritten code. */
.signature-request-siwe__actionable-message {
margin: 0 16px 16px;
margin: 0 16px;
flex-direction: row;
align-items: initial;
.icon {
position: absolute;
left: 17px;
top: 13px;
}
}
.actionable-message--with-icon.actionable-message--with-right-button {
padding-left: 48px;
.actionable-message__message {
padding-left: 16px;
}
&.actionable-message--with-icon {
padding-left: 16px;
}
}
}

View File

@ -131,7 +131,6 @@ export default function SignatureRequestSIWE({
}
iconFillColor="var(--color-error-default)"
useIcon
withRightButton
icon={<Icon name="danger" color={IconColor.errorDefault} />}
/>
)}