include option upgradeURL CSP in checkup page tests

pull/1/head
ansuz 3 years ago
parent c062aaf6f5
commit 6a62e28c60

@ -15,13 +15,14 @@ define([
'/customize/pages.js', '/customize/pages.js',
'/checkup/checkup-tools.js', '/checkup/checkup-tools.js',
'/common/outer/network-config.js', '/common/outer/network-config.js',
'/customize/application_config.js',
'/bower_components/tweetnacl/nacl-fast.min.js', '/bower_components/tweetnacl/nacl-fast.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/checkup/app-checkup.less', 'less!/checkup/app-checkup.less',
], function ($, ApiConfig, Assertions, h, Messages, DomReady, ], function ($, ApiConfig, Assertions, h, Messages, DomReady,
nThen, SFCommonO, Login, Hash, Util, Pinpad, nThen, SFCommonO, Login, Hash, Util, Pinpad,
NetConfig, Pages, Tools, NetConfig) { NetConfig, Pages, Tools, NetConfig, AppConfig) {
var Assert = Assertions(); var Assert = Assertions();
var trimSlashes = function (s) { var trimSlashes = function (s) {
if (typeof(s) !== 'string') { return s; } if (typeof(s) !== 'string') { return s; }
@ -81,6 +82,17 @@ define([
console.error(err); console.error(err);
}; };
var ACCOUNTS_URL;
try {
if (typeof(AppConfig.upgradeURL) === 'string') {
ACCOUNTS_URL = new URL(AppConfig.upgradeURL, trimmedUnsafe).origin;
}
} catch (err) {
console.error(err);
}
assert(function (cb, msg) { assert(function (cb, msg) {
msg.appendChild(h('span', [ msg.appendChild(h('span', [
"CryptPad's sandbox requires that both ", "CryptPad's sandbox requires that both ",
@ -970,6 +982,9 @@ define([
$sandbox, $sandbox,
API_URL.origin, API_URL.origin,
isHTTPS(fileHost)? fileHost: undefined, isHTTPS(fileHost)? fileHost: undefined,
// support for cryptpad.fr configuration
AppConfig.accounts_api,
![trimmedUnsafe, trimmedSafe].includes(ACCOUNTS_URL)? ACCOUNTS_URL: undefined,
], ],
'img-src': ["'self'", 'data:', 'blob:', $outer], 'img-src': ["'self'", 'data:', 'blob:', $outer],

Loading…
Cancel
Save