summaryrefslogtreecommitdiffstats
path: root/tests/lib/Security
Commit message (Collapse)AuthorAgeFilesLines
* Add bruteforce capabilitiesRoeland Jago Douma2017-07-131-0/+68
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Write cert bundle to tmp file firstRoeland Jago Douma2017-07-121-2/+15
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Automatic creation of Identity managerJoas Schilling2017-05-101-3/+14
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Add missing spaceLukas Reschke2017-05-011-1/+1
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Mark IP as whitelisted if brute force protection is disabledLukas Reschke2017-05-011-8/+51
| | | | | | | | Currently, when disabling the brute force protection no new brute force attempts are logged. However, the ones logged within the last 24 hours will still be used for throttling. This is quite an unexpected behaviour and caused some support issues. With this change when the brute force protection is disabled also the existing attempts within the last 24 hours will be disregarded. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Remove expired attemptsLukas Reschke2017-04-131-5/+13
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Add support for ratelimiting via annotationsLukas Reschke2017-04-134-45/+358
| | | | | | | | | | | | | This allows adding rate limiting via annotations to controllers, as one example: ``` @UserRateThrottle(limit=5, period=100) @AnonRateThrottle(limit=1, period=100) ``` Would mean that logged-in users can access the page 5 times within 100 seconds, and anonymous users 1 time within 100 seconds. If only an AnonRateThrottle is specified that one will also be applied to logged-in users. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Respect bruteforce settings in the ThrottlerRoeland Jago Douma2017-04-021-1/+89
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix unit testsMorris Jobke2017-03-281-1/+1
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Add base-uri to CSP policyLukas Reschke2017-03-161-1/+1
| | | | | | As per https://twitter.com/we1x/status/842032709543333890 a nice security hardening Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* dont write a certificate bundle if the shipped ca bundle is emptyRobin Appelman2017-01-091-3/+4
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Add Identityproof testsRoeland Jago Douma2016-11-243-1/+250
| | | | | | | | | * Add tests for Key * Add tests for Manager * Add tests for Signer * Removed URLGenerator from Signer Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add a signer class for signingLukas Reschke2016-11-211-0/+166
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Add testsLukas Reschke2016-11-021-0/+13
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Inject config and loggerJoas Schilling2016-11-021-3/+9
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix CSRF token generation / validationLeon Klingele2016-11-022-4/+12
| | | | | | | Operate on raw bytes instead of base64-encoded strings. Issue was introduced in a977465 Signed-off-by: Leon Klingele <git@leonklingele.de>
* Move browserSupportsCspV3 to CSPNonceManagerRoeland Jago Douma2016-10-251-1/+3
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add ContentSecurityPolicyNonceManagerLukas Reschke2016-10-241-0/+57
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Add support for CSP noncesLukas Reschke2016-10-242-0/+23
| | | | | | | | | | | | | | | | | 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>
* Fix getMock CertificateMangerTestRoeland Jago Douma2016-09-131-2/+3
|
* Fix getMock SecurityRoeland Jago Douma2016-09-072-4/+4
|
* Implement brute force protectionLukas Reschke2016-07-201-0/+123
| | | | | | | | | Class Throttler implements the bruteforce protection for security actions in Nextcloud. It is working by logging invalid login attempts to the database and slowing down all login attempts from the same subnet. The max delay is 30 seconds and the starting delay are 200 milliseconds. (after the first failed login)
* add test for needsRebundling() checkBjoern Schiessle2016-07-111-0/+92
|
* Disallow certain malformed domain names even if they match the trusted ↵Johannes Ernst2016-07-061-0/+4
| | | | | | domain expression Stricter checking for valid domain names
* Trusted domain wildcard checking made shorter, supporting multiple *Johannes Ernst2016-07-061-1/+26
| | | | Added test cases
* Move tests/ to PSR-4 (#24731)Joas Schilling2016-05-2012-0/+1092
* Move a-b to PSR-4 * Move c-d to PSR-4 * Move e+g to PSR-4 * Move h-l to PSR-4 * Move m-r to PSR-4 * Move s-u to PSR-4 * Move files/ to PSR-4 * Move remaining tests to PSR-4 * Remove Test\ from old autoloader