mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-08 09:43:42 +01:00
whitelist of protocols for can launch
This commit is contained in:
parent
3fd65dd82f
commit
ff981532fd
@ -6,6 +6,16 @@ import { LoginUri } from '../domain/loginUri';
|
|||||||
|
|
||||||
import { Utils } from '../../misc/utils';
|
import { Utils } from '../../misc/utils';
|
||||||
|
|
||||||
|
const CanLaunchWhitelist = [
|
||||||
|
'https://',
|
||||||
|
'http://',
|
||||||
|
'ssh://',
|
||||||
|
'ftp://',
|
||||||
|
'sftp://',
|
||||||
|
'irc://',
|
||||||
|
'chrome://',
|
||||||
|
];
|
||||||
|
|
||||||
export class LoginUriView implements View {
|
export class LoginUriView implements View {
|
||||||
match: UriMatchType = null;
|
match: UriMatchType = null;
|
||||||
|
|
||||||
@ -62,6 +72,14 @@ export class LoginUriView implements View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get canLaunch(): boolean {
|
get canLaunch(): boolean {
|
||||||
return this.uri != null && this.uri.indexOf('://') > -1;
|
if (this.uri == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < CanLaunchWhitelist.length; i++) {
|
||||||
|
if (this.uri.indexOf(CanLaunchWhitelist[i]) === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user