Skip to content

Commit

Permalink
siwe: re-enable warning UI for mismatched domains
Browse files Browse the repository at this point in the history
- unblocks mismatched domain support
- we may re-add error handling here #18184
- reverts logic from #16616
  • Loading branch information
digiwand committed Mar 16, 2023
1 parent 2ccc515 commit d924916
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
9 changes: 0 additions & 9 deletions app/scripts/lib/personal-message-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 0 additions & 10 deletions app/scripts/lib/personal-message-manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});

0 comments on commit d924916

Please sign in to comment.