summaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework
Commit message (Collapse)AuthorAgeFilesLines
* Handle SameSiteCookie check for index.php in AppFramework MiddlewareRoeland Jago Douma2017-09-242-2/+145
| | | | 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>
* Remove explicit type hints for ControllerLukas Reschke2017-08-011-4/+4
| | | | | | This is public API and breaks the middlewares of existing apps. Since this also requires maintaining two different code paths for 12 and 13 I'm at the moment voting for reverting this change. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Merge pull request #5907 from nextcloud/add-metadata-to-throttle-callMorris Jobke2017-08-012-0/+9
|\ | | | | Add metadata to \OCP\AppFramework\Http\Response::throttle
| * Add metadata to \OCP\AppFramework\Http\Response::throttleLukas Reschke2017-07-272-0/+9
| | | | | | | | | | | | Fixes https://github.com/nextcloud/server/issues/5891 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* | Fix testsRoeland Jago Douma2017-07-313-61/+66
| | | | | | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* | Fix middleware implementations signaturesRoeland Jago Douma2017-07-311-4/+5
|/ | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Remove deprecated Controller FunctionsRoeland Jago Douma2017-07-201-69/+0
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Make BruteForceProtection annotation more cleverLukas Reschke2017-04-133-75/+196
| | | | | | | | 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>
* Add tests for multiple parametersLukas Reschke2017-04-131-5/+19
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Move to dedicated MiddleWareLukas Reschke2017-04-132-40/+287
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Add support for ratelimiting via annotationsLukas Reschke2017-04-131-4/+40
| | | | | | | | | | | | | 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>
* 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-285-111/+111
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Add DI intergration testsRoeland Jago Douma2017-03-211-0/+136
| | | | | | | | | * Moved some interface definitions to Server.php (more to come) * Build/Query only for existing classes in the AppContainer * Build/Query only for classes of the App in the AppContainer * Offload other stuff to the servercontainer Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Extend DI testsRoeland Jago Douma2017-03-211-5/+14
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Adjust tests to include base-uriLukas Reschke2017-03-162-2/+2
| | | | 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>
* add some unit testsBjoern Schiessle2017-01-182-1/+85
| | | | Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
* fix controller testChristoph Wurst2017-01-101-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>
* Merge pull request #2066 from nextcloud/fix-redirect-double-encodingMorris Jobke2016-11-291-6/+6
|\ | | | | do not double encode the redirect url
| * do not double encode the redirect urlChristoph Wurst2016-11-091-6/+6
| | | | | | | | 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>
* | Merge pull request #1447 from nextcloud/password-confirmation-for-some-actionsMorris Jobke2016-11-181-0/+5
|\ \ | | | | | | Password confirmation for some actions
| * | Fix unit testsJoas Schilling2016-11-181-0/+5
| |/ | | | | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* / 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>
* Move browserSupportsCspV3 to CSPNonceManagerRoeland Jago Douma2016-10-251-5/+10
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add support for CSP noncesLukas Reschke2016-10-242-1/+76
| | | | | | | | | | | | | | | | | 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 testsRoeland Jago Douma2016-09-152-38/+43
|
* Fix getMock MapperTestUtilityRoeland Jago Douma2016-09-071-1/+1
|
* Split OCS version handlingRoeland Jago Douma2016-09-062-28/+85
| | | | | | This cleans up a bit the OCSController/Middleware. Since the 2 versions of OCS differ a bit. Moved a lot of stuff internal since it is of no concern to the outside.
* 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.
* No body or content-length for 204 and 304 responsesRoeland Jago Douma2016-08-311-1/+28
| | | | See: https://tools.ietf.org/html/rfc7230#section-3.3
* 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
* | Add testsRoeland Jago Douma2016-08-141-6/+70
| |
* | OCSController requires DataResponseRoeland Jago Douma2016-08-101-52/+5
| | | | | | | | | | | | The OCS Controller requires a DataResponse object to be returned. This means that all error handling will have to be done via exceptions thrown and handling in the middleware.
* | Merge pull request #691 from nextcloud/ocs_allow_all_old_routesLukas Reschke2016-08-091-7/+7
|\ \ | |/ |/| Allow ocs/v2.php/cloud/... routes
| * Allow ocs/v2.php/cloud/... routesRoeland Jago Douma2016-08-081-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the possibilities of the old OCS API is that you can define the url yourself. This PR makes this possible again by adding an optional root elemenet to the route. Routes are thus: .../ocs/v2.php/<root>/<url> By default <root> = apps/<app> This will allow for example the provisioning API etc to be in ../ovs/v2/php/cloud/users
* | Hanlde Core and Settings app in AppFrameworkRoeland Jago Douma2016-08-081-0/+51
|/ | | | | | 'core' and 'settings' are just apps but we treat them slightly different. Make sure that we construct the correct namespace so we can actually do automatic AppFramework stuff.
* We should properly check for 'true' instaed of the boolRoeland Jago Douma2016-08-011-1/+2
|
* Dark hackery to not always disable CSRF for OCS controllersRoeland Jago Douma2016-07-291-0/+55
|
* Support subdir in the OCS v2 endpointRoeland Jago Douma2016-07-271-0/+30
| | | | | | | We should check against the ending substring since people could run their nextcloud in a subfolder. * Added test
* Add testsRoeland Jago Douma2016-07-221-1/+35
|