nextcloud/tests/lib
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
..
Activity Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
App Ensure $commands being an array - fixes #26073 2016-10-20 15:40:27 +02:00
AppFramework Add support for CSP nonces 2016-10-24 12:27:50 +02:00
Archive Remove unneeded checks if it runs on a Windows machine 2016-07-08 15:55:17 +02:00
Authentication Do not use underscores in PSR4 namespaces of the backup codes app 2016-10-03 21:47:33 +02:00
BackgroundJob Fix getMock JobListTest 2016-09-13 09:09:52 +02:00
Cache Fix getMock FileCacheTest 2016-09-13 09:09:52 +02:00
Command Fix getMock Command/Intergrity 2016-09-07 20:42:37 +02:00
Comments Fix DateTime comparisson 2016-10-21 13:43:39 +02:00
DB Fix the test 2016-10-19 00:15:01 +02:00
Encryption Fix shared storage namespace in DecryptAll class 2016-10-20 20:36:50 +02:00
Files Added method to DB and fix test 2016-10-24 09:45:04 +02:00
Group Fix getMock MetaDataTest 2016-09-07 20:42:37 +02:00
Hooks Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
Http/Client Fix getMock Http Client 2016-09-07 20:42:37 +02:00
IntegrityCheck Make sure memory limit is > post size and upload filesize 2016-09-13 16:50:36 +02:00
L10N Fix getMock L10NTest 2016-09-07 20:42:38 +02:00
Lock Fix getMock DBLockingProviderTest 2016-09-13 09:09:53 +02:00
Log Renamed test classes for file logging tests. 2016-07-22 14:47:50 +02:00
Mail Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
Memcache Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
Migration Fix getMock Migration 2016-09-07 20:42:38 +02:00
Notification Add an icon to the notification API 2016-10-07 17:00:24 +02:00
OCS Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
Preview Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
PublicNamespace Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
Repair Fix test of repair step 2016-10-19 00:15:01 +02:00
Security Add support for CSP nonces 2016-10-24 12:27:50 +02:00
Session Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
Settings Fix tests 2016-09-08 20:11:21 +02:00
Share Make sure all tests use the TestCase method to overwrite services 2016-10-20 15:19:41 +02:00
Share20 Fix DateTime comparisson 2016-10-21 13:43:39 +02:00
SystemTag Act on effective system tag canAssign permission 2016-05-20 17:56:02 +02:00
Template Fix getMock Template 2016-09-07 20:42:38 +02:00
Traits Fix phpunit Trait warning 2016-07-08 19:36:17 +02:00
Updater Use the same URL everywhere 2016-09-27 14:52:22 +02:00
User Add test to ensure token times are updated 2016-10-11 11:06:24 +02:00
Util Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
APITest.php FIx lib/ a-d 2016-05-19 09:27:21 +02:00
AllConfigTest.php Revert "Downstream 2016-06-08" 2016-06-09 17:41:57 +02:00
AppConfigTest.php Make sure all tests use the TestCase method to overwrite services 2016-10-20 15:19:41 +02:00
AppTest.php Make sure all tests use the TestCase method to overwrite services 2016-10-20 15:19:41 +02:00
AutoLoaderTest.php Fix unit tests 2016-05-20 16:35:07 +02:00
AvatarManagerTest.php Fix avatar tests 2016-10-05 11:00:17 +02:00
AvatarTest.php avatar to appdata 2016-10-05 11:00:16 +02:00
CapabilitiesManagerTest.php Make the capabilities manager more error proof 2016-08-15 20:37:19 +02:00
ConfigTest.php FIx lib/ a-d 2016-05-19 09:27:21 +02:00
ContactsManagerTest.php FIx lib/ a-d 2016-05-19 09:27:21 +02:00
DateTimeFormatterTest.php Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
ErrorHandlerTest.php FIx lib/ a-d 2016-05-19 09:27:21 +02:00
FileChunkingTest.php Fix getMock FileChunkingTest 2016-09-07 20:42:37 +02:00
FilesTest.php Make sure memory limit is > post size and upload filesize 2016-09-13 16:50:36 +02:00
HTTPHelperTest.php Fix getMock HTTPHelper 2016-09-07 20:42:37 +02:00
HelperStorageTest.php Fix getMock HelperStorageTest 2016-09-13 09:09:53 +02:00
HookHelper.php Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
ImageTest.php Remove unneeded checks if it runs on a Windows machine 2016-07-08 15:55:17 +02:00
InfoXmlTest.php Add tests for commands in info.xml 2016-10-11 19:48:31 +02:00
InstallerTest.php OC_Installer -> \OC\Installer 2016-05-02 08:52:06 +02:00
LargeFileHelperGetFileSizeTest.php Remove unneeded Windows logic 2016-09-01 10:47:57 +02:00
LargeFileHelperTest.php Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
LegacyHelperTest.php Simplify isSubDirectory check 2016-10-07 21:56:43 +02:00
LoggerTest.php add test 2016-08-22 16:56:00 +02:00
NaturalSortTest.php Fix lib/ 2016-05-19 09:38:52 +02:00
NavigationManagerTest.php Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
OCSClientTest.php Fix getMock OCSClient 2016-09-07 20:42:38 +02:00
PreviewTest.php Fix failing preview unit tests (#26039) 2016-09-12 16:46:39 +02:00
RepairStepTest.php Fix lib/ 2016-05-19 09:38:52 +02:00
ServerTest.php Fix loading of ThemingDefaults 2016-08-19 11:26:22 +02:00
SetupTest.php Fix getMock SetupTest 2016-09-07 20:42:38 +02:00
StreamWrappersTest.php Get rid of very old oc:// stream wrapper (#26381) 2016-10-20 20:46:30 +02:00
SubAdminTest.php Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
TagsTest.php Fix getMock TagTest 2016-09-13 09:09:53 +02:00
TempManagerTest.php Fix getMock TempManagerTest 2016-09-07 20:42:38 +02:00
TemplateFunctionsTest.php Fix lib/ 2016-05-19 09:38:52 +02:00
TestCase.php Restore all services when a tests failed/finished for better testcase isolation 2016-10-20 15:19:41 +02:00
TestMoveableMountPoint.php Move tests/ to PSR-4 (#24731) 2016-05-20 15:38:20 +02:00
UpdaterTest.php Kill update simulation 2016-09-27 18:43:53 +02:00
UrlGeneratorTest.php Fix getMock UrlGeneratortest 2016-09-13 09:09:53 +02:00
UserTest.php Fix failing tests after db split 2016-07-13 09:26:19 +02:00
UtilCheckServerTest.php Remove unneeded checks if it runs on a Windows machine 2016-07-08 15:55:17 +02:00
UtilTest.php Make sure all tests use the TestCase method to overwrite services 2016-10-20 15:19:41 +02:00