nextcloud/tests
Lukas Reschke 9e6634814e
Add support for CSP nonces
CSP nonces are a feature available with CSP v2. Basically instead of saying "JS resources from the same domain are ok to be served" we now say "Ressources from everywhere are allowed as long as they add a `nonce` attribute to the script tag with the right nonce.

At the moment the nonce is basically just a `<?php p(base64_encode($_['requesttoken'])) ?>`, we have to decode the requesttoken since `:` is not an allowed value in the nonce. So if somebody does on their own include JS files (instead of using the `addScript` public API, they now must also include that attribute.)

IE does currently not implement CSP v2, thus there is a whitelist included that delivers the new CSP v2 policy to newer browsers. Check http://caniuse.com/#feat=contentsecuritypolicy2 for the current browser support list. An alternative approach would be to just add `'unsafe-inline'` as well as `'unsafe-inline'` is ignored by CSPv2 when a nonce is set. But this would make this security feature unusable at all in IE. Not worth it at the moment IMO.

Implementing this offers the following advantages:

1. **Security:** As we host resources from the same domain by design we don't have to worry about 'self' anymore being in the whitelist
2. **Performance:** We can move oc.js again to inline JS. This makes the loading way quicker as we don't have to load on every load of a new web page a blocking dynamically non-cached JavaScript file.

If you want to toy with CSP see also https://csp-evaluator.withgoogle.com/

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-24 12:27:50 +02:00
..
Core Check the mimetype before reading the content and catch exception 2016-10-18 16:22:20 +02:00
Settings phpunit min version is 4.8 2016-10-06 14:07:32 +02:00
apps [App Code Check] add check for version and mandatory fields 2015-09-24 11:58:12 +02:00
data Adding tests for 4 byte unicode characters 2016-10-19 00:15:01 +02:00
docker Adding docker based unit test execution for mysql utf8mb4 2016-10-19 00:15:01 +02:00
lib Add support for CSP nonces 2016-10-24 12:27:50 +02:00
objectstore fix swift primary object store test (#25281) 2016-07-05 08:54:51 +02:00
travis Changed name of default logfile from owncloud.log to nextcloud.log. 2016-07-04 11:50:32 +02:00
apps.php Fix the tests again 2016-05-25 16:51:02 +02:00
bootstrap.php Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
enable_all.php implementation of the federated share provider 2016-02-08 11:30:48 +01:00
karma.config.js Add system tags filter section for files app 2016-02-09 10:59:29 +01:00
phpunit-autotest-external.xml Adjust the phpunit config 2016-05-25 15:14:37 +02:00
phpunit-autotest.xml Exclude tests and composer dir from coverage 2016-10-05 12:05:51 +02:00
preseed-config.php Do not add apps2/ directory if it does not exist 2015-03-19 09:07:29 +01:00
startsessionlistener.php Make compatible with PHPUnit 5.1 2015-12-10 09:22:41 +01:00