Mm 16694 master validate urls (#1000)

* validate urls before deeplink or link click

* tests for isValidURL utility function

* review change - invert condition

* add validation for loaded files

bounds-info.json, app-state.json, config.json

* further validation and tweaks

certificate.json, permission.json

* add 2 more files for validation

* parse and validate deeplinks

- includes fix for windows deeplink when app is open

* disable auto-updator when in dev

* Squirrel is not used anymore

* fix validating allowedProtocols

* discard any args following a deeplink url

* tweaks

* update test

* support scheme’s with and without slashes

* stop after finding the first occurance of a deep link

* test updates

* updates to run tests successfully

* port updates to validation from 4.2

* url validation updates

changed validation package to better support internal domains and punycode domains
This commit is contained in:
Dean Whillier
2019-09-09 12:38:31 -04:00
committed by GitHub
parent f12f9da798
commit e12d47ea62
25 changed files with 585 additions and 171 deletions

View File

@@ -6,6 +6,8 @@
import fs from 'fs';
import url from 'url';
import * as Validator from './Validator';
function comparableCertificate(certificate) {
return {
data: certificate.data.toString(),
@@ -32,6 +34,10 @@ function CertificateStore(storeFile) {
let storeStr;
try {
storeStr = fs.readFileSync(storeFile, 'utf-8');
storeStr = Validator.validateCertificateStore(storeStr);
if (!storeStr) {
throw new Error('Provided certificate store file does not validate, using defaults instead.');
}
} catch (e) {
storeStr = '{}';
}