mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-08 19:18:02 +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';
|
||||
|
||||
const CanLaunchWhitelist = [
|
||||
'https://',
|
||||
'http://',
|
||||
'ssh://',
|
||||
'ftp://',
|
||||
'sftp://',
|
||||
'irc://',
|
||||
'chrome://',
|
||||
];
|
||||
|
||||
export class LoginUriView implements View {
|
||||
match: UriMatchType = null;
|
||||
|
||||
@ -62,6 +72,14 @@ export class LoginUriView implements View {
|
||||
}
|
||||
|
||||
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