mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +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:
parent
6cc7ab212e
commit
4f36a3121c
@ -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();
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,6 @@ export default function SignatureRequestSIWE({
|
||||
}
|
||||
iconFillColor="var(--color-error-default)"
|
||||
useIcon
|
||||
withRightButton
|
||||
icon={<Icon name="danger" color={IconColor.errorDefault} />}
|
||||
/>
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user