summaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Http
Commit message (Collapse)AuthorAgeFilesLines
* allow 'Nextcloud' in the user agent string of AndroidBjoern Schiessle2017-12-121-0/+14
| | | | Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
* Use ::class in test mocksMorris Jobke2017-10-242-7/+8
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Handle SameSiteCookie check for index.php in AppFramework MiddlewareRoeland Jago Douma2017-09-241-2/+12
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add CSP frame-ancestors supportThomas Citharel2017-09-151-0/+41
| | | | | | Didn't set the @since annotation yet. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
* Add metadata to \OCP\AppFramework\Http\Response::throttleLukas Reschke2017-07-271-0/+5
| | | | | | Fixes https://github.com/nextcloud/server/issues/5891 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Make BruteForceProtection annotation more cleverLukas Reschke2017-04-131-0/+5
| | | | | | | | This makes the new `@BruteForceProtection` annotation more clever and moves the relevant code into it's own middleware. Basically you can now set `@BruteForceProtection(action=$key)` as annotation and that will make the controller bruteforce protected. However, the difference to before is that you need to call `$responmse->throttle()` to increase the counter. Before the counter was increased every time which leads to all kind of unexpected problems. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Don't try to parse empty body if there is no bodyRoeland Jago Douma2017-04-041-1/+4
| | | | | | | | | | | | Fixes #3890 If we do a put request without a body the current code still tries to read the body. This patch makes sure that we do not try to read the body if the content length is 0. See RFC 2616 Section 4.3 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix unit testsMorris Jobke2017-03-284-110/+110
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Adjust tests to include base-uriLukas Reschke2017-03-161-1/+1
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Add base-uri to CSP policyLukas Reschke2017-03-163-109/+109
| | | | | | As per https://twitter.com/we1x/status/842032709543333890 a nice security hardening Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* add test for skipping cookie checks for ocsRobin Appelman2017-03-101-0/+25
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* oc_token should be nc_tokenChristoph Wurst2017-02-021-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* fix data response test expected cache headersChristoph Wurst2017-01-101-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* set 'no-store' cache header if we do not want FF to cacheChristoph Wurst2017-01-091-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Harden cookies more appropriateLukas Reschke2016-11-231-0/+70
| | | | | | | | | | This adds the __Host- prefix to the same-site cookies. This is a small but yet nice security hardening. See https://googlechrome.github.io/samples/cookie-prefixes/ for the implications. Fixes https://github.com/nextcloud/server/issues/1412 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* add tests for http/outputRobin Appelman2016-11-161-0/+31
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Identify Chromium as ChromeJoas Schilling2016-10-261-0/+14
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Add support for CSP noncesLukas Reschke2016-10-241-0/+24
| | | | | | | | | | | | | | | | | 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>
* Add FileDisplayResponseRoeland Jago Douma2016-09-051-0/+109
| | | | | A lazy implementation of the DisplayResponse that only hits the filesystem if the etag and mtime do not match.
* Merge pull request #797 from nextcloud/only-match-for-auth-cookieJoas Schilling2016-08-311-1/+77
|\ | | | | Match only for actual session cookie
| * Match only for actual session cookieLukas Reschke2016-08-091-1/+77
| | | | | | | | OVH has implemented load balancing in a very questionable way where the reverse proxy actually internally adds some cookies which would trigger a security exception. To work around this, this change only checks for the session cookie.
* | Remove reading PATH_INFO from server variableLukas Reschke2016-08-191-16/+0
|/ | | | | | Having two code paths for this is unreliable and can lead to bugs. Also, in some cases Apache isn't setting the PATH_INFO variable when mod_rewrite is used. Fixes https://github.com/nextcloud/server/issues/983
* [master] Port Same-Site Cookies to masterLukas Reschke2016-07-201-28/+279
| | | | Fixes https://github.com/nextcloud/server/issues/50
* Fix phpunit-5.4 wargningRoeland Jago Douma2016-07-113-18/+48
| | | | | * getMock is deprecated. * \PDOStatement mocking fails hard on phpunit 4.8
* Move tests/ to PSR-4 (#24731)Joas Schilling2016-05-2014-0/+3852
* 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