1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

check event.data type. some debug logging

This commit is contained in:
Kyle Spearrin 2018-07-21 14:07:06 -04:00
parent 57ce9d5315
commit 7b89ad6bf7

View File

@ -47,6 +47,8 @@ export class U2f {
}
private parseMessage(event: any) {
console.log('got u2f event');
console.log(event);
if (!this.validMessage(event)) {
this.errorCallback('Invalid message.');
return;
@ -63,8 +65,8 @@ export class U2f {
}
private validMessage(event: any) {
if (!event.origin || event.origin === '' ||
event.origin !== (this.connectorLink as any).origin || !event.data) {
if (event.origin == null || event.origin === '' || event.origin !== (this.connectorLink as any).origin ||
event.data == null || typeof (event.data) !== 'string') {
return false;
}