Commit Graph

3288 Commits

Author SHA1 Message Date
Lukas Reschke 32bf8ec826
Don't use cached informations for app version
When installing an app from the appstore the `\OC_App::getAppVersion` code is triggered twice:

- First when the downloader tries to compare the current version to the new version on the appstore to check if there is a newer version. This protects against downgrade attacks and is implemented in `\OC\Installer::downloadApp`.
- Second, when the app is actually installed the current version is written to the database. (`\OC\Installer::installApp`)

This fails however when the version is actually cached. Because in step 1 the cached version will be set to "0" and then be reused in the second step.

While this is probably not the cleanest version I assume this is an approach that is least invasive. Feedback and suggestions welcome :)

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-09 18:01:45 +01:00
Morris Jobke 7aa510b2f0
Document updater channel & check for correct PHP version in updater
* see https://github.com/nextcloud/updater/issues/53

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2016-12-06 00:19:13 +01:00
Morris Jobke aac3024878 Merge pull request #2505 from nextcloud/sudo-mode-provisioning-api
Require sudo mode on the provisioning API
2016-12-05 22:29:29 +01:00
Roeland Jago Douma e368a745aa
Set last-login-check on basic auth
Else the last-login-check fails hard because the session value is not
set and thus defaults to 0.

* Started with tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-12-05 20:57:15 +01:00
Morris Jobke 1253d1008a Merge pull request #2411 from nextcloud/fix-encryption-home-storage
check if the file should really be encrypted before we update the file cache
2016-12-05 15:38:12 +01:00
Robin Appelman 1a379b0fdc
update test
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-12-02 18:04:21 +01:00
Lukas Reschke 2ca29f709b
Add tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-12-01 18:52:32 +01:00
Morris Jobke 62ec31eb7b Merge pull request #2152 from nextcloud/preview_cleanupjob
Adds background job to cleanup all previews.
2016-11-30 10:39:21 +01:00
Bjoern Schiessle 0f8fe77b3a
check if the file should really be encrypted before we update the file cache
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-29 20:34:45 +01:00
Morris Jobke d86b29b42b Merge pull request #2066 from nextcloud/fix-redirect-double-encoding
do not double encode the redirect url
2016-11-29 17:21:43 +01:00
Lukas Reschke 3950ce9223 Merge pull request #2351 from nextcloud/remember-session-default
do not remember session tokens by default
2016-11-28 14:05:04 +01:00
Lukas Reschke 0cc771ce19 Merge pull request #2353 from nextcloud/renew-session-token-remember
copy remember-me value when renewing a session token
2016-11-28 14:04:13 +01:00
Christoph Wurst 6543182d13 fix parameter order
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2016-11-28 10:00:53 +01:00
Christoph Wurst ad610ae772 Merge pull request #2327 from nextcloud/exclude-pre-releases
Exclude pre-release versions as per SemVer
2016-11-28 09:55:24 +01:00
Christoph Wurst 2183a1f3e6 copy remember-me value when renewing a session token
On renew, a session token is duplicated. For some reason we did
not copy over the remember-me attribute value. Hence, the new token
was deleted too early in the background job and remember-me did
not work properly.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2016-11-27 14:19:57 +01:00
Christoph Wurst 9b808c4014 do not remember session tokens by default
We have to respect the value of the remember-me checkbox. Due to an error
in the source code the default value for the session token was to remember
it.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2016-11-27 14:03:28 +01:00
Morris Jobke 64fb0fb3dd Merge pull request #2276 from nextcloud/update-email-address
Update email address
2016-11-25 11:40:20 +01:00
Lukas Reschke 29402e2c0a
Exclude pre-release versions as per SemVer
As SemVer can be used apps could define a release like "10.0.0-alpha". This is something that we don't support at the moment in the server and we should filter all prereleases.

Ref https://github.com/nextcloud/server/pull/2307#issuecomment-262911588

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-25 11:32:46 +01:00
Bjoern Schiessle 0de685c562
bring back setEmailAddress for the user management
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-25 10:26:48 +01:00
Bjoern Schiessle 3fc75073b8
update accounts table if email address or display name changes from outside
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-25 10:26:47 +01:00
Roeland Jago Douma 72f9920a58
Add Identityproof tests
* 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>
2016-11-24 21:50:19 +01:00
Lukas Reschke 6a4c0cf237
Loop for newest version in appstore response
The current implementation when fetching apps from the appstore is to assume that the first element is the newest version, this is now always applicable and leads to the fact that for some apps (e.g. nextant) the newest version is not delivered. This can be easily tested by comparing the version of the downloaded Nextant version.

This change will loop over all releases delivered by the appstore and chooses the newest compatible one. While not the cleanest solution, it does its job.

Most of the code are actually unit tests. Whereas I have copied the whole original response from the appstore and also have performed the transformation. So that's why the diff looks so huge.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-24 14:29:57 +01:00
Lukas Reschke a05b8b7953
Harden cookies more appropriate
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>
2016-11-23 12:53:44 +01:00
Roeland Jago Douma df215625f1 Merge pull request #1972 from nextcloud/invalid-files-from-scanner
Make sure we don't scan files that can not be accessed
2016-11-22 12:55:54 +01:00
Robin Appelman cd24010fa4 Merge pull request #2214 from nextcloud/remove-logging
remove old logging section
2016-11-21 17:17:02 +01:00
Robin Appelman 0048b3aa2e
update tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-21 15:59:08 +01:00
Lukas Reschke d001dbd259
Adjust unit tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-21 11:30:03 +01:00
Lukas Reschke fb91bf6a5b
Add a signer class for signing
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-21 11:30:00 +01:00
Bjoern Schiessle b23a4ca96b
push public user data to the lookup server
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-21 11:29:59 +01:00
Bjoern Schiessle c5e61947a9
remove old test class
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-21 11:29:59 +01:00
Bjoern Schiessle 08e6541a88
fix unit tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-21 11:29:58 +01:00
Björn Schießle 40b99734d3
introduce accounts table and keep it up-to-date with the data added to the personal settings
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-21 11:29:41 +01:00
Joas Schilling 558f169671
Move the validation into one place only
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-21 09:23:37 +01:00
Joas Schilling 4652d203e3
Make sure we don't scan files that can not be accessed
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-21 09:23:32 +01:00
Roeland Jago Douma 78a318d388
Add test if repair step is already done
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-19 20:26:53 +01:00
Roeland Jago Douma ccb05dbb17
Adds background job to cleanup all previews.
* A repair step that inserts a background job for each user
* Each background job will delete for 15 seconds if it takes longer we
reschedule. This is done so instances that don't use the system cron
won't time out.
* Added tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-19 20:14:44 +01:00
Lukas Reschke 8ec2e34576 Merge pull request #1602 from nextcloud/ignore-mod-env
Add system config htaccess.IgnoreFrontController for prettyURLs w/o mod_env
2016-11-18 21:42:56 +01:00
Morris Jobke 46768e71d9 Merge pull request #2076 from nextcloud/log_preview_access
Dispatch event on preview request
2016-11-18 20:45:29 +01:00
Morris Jobke 332eaec4c0 Merge pull request #1447 from nextcloud/password-confirmation-for-some-actions
Password confirmation for some actions
2016-11-18 15:42:30 +01:00
Robin Appelman 8b9ad46ba3 Merge pull request #768 from nextcloud/s3-objectstore
Add S3 objectstore backend
2016-11-18 14:55:07 +01:00
Joas Schilling b2d9c20aac
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-18 12:10:51 +01:00
Julius Haertl caacb6c261
Expose getAppPath to public API
Signed-off-by: Julius Haertl <jus@bitgrid.net>
2016-11-17 19:24:24 +01:00
Felix Epp 1614b310ef Add system config htaccess.IgnoreFrontController for prettyURLs w/o mod_env
Added the system config which sets all conditions to true that query the
FrontControllerActive mod_env variable.

Signed-off-by: Felix A. Epp <work@felixepp.de>
2016-11-16 22:28:49 +01:00
Robin Appelman 4ac5fdcf11
add tests for FileInfo::isMounted
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:30:37 +01:00
Robin Appelman e4d1cf0f6d
add tests for http/output
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:30:37 +01:00
Robin Appelman eefd059716
add amazon s3 objectstore backend
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:30:36 +01:00
Robin Appelman 64e896cc0d
split testing of objectstoragestorage and objectstore implementations
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:30:36 +01:00
Robin Appelman e633f2f8df
add test
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:24:33 +01:00
Robin Appelman e77432783b
Add test for setting up fake fs
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:24:32 +01:00
Roeland Jago Douma 59d6003f89
Adds NullCache ans NullStorage tests for Lockdown
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-16 15:24:31 +01:00
Roeland Jago Douma e5bc80b31d
Adds TokenProvider and Mapper tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-16 15:24:31 +01:00
Robin Appelman 91851c37be
add tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:24:30 +01:00
Robin Appelman 4c3d18a9fc
explicit types
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-16 15:24:29 +01:00
Joas Schilling b8958ee937
Fix activity manager tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-16 09:25:45 +01:00
Roeland Jago Douma 28babd319b Merge pull request #2137 from nextcloud/make-sure-tests-run-on-phpunit-4-again
Add a magic wrapper to allow phpunit4 to run the code again
2016-11-15 21:48:55 +01:00
Lukas Reschke b775d935f2
Endpoint is now 11.0.0
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-15 15:10:17 +01:00
Lukas Reschke 5fd428413b
Adjust previous fallbacks
11.0 is 11 and not 9.2 anymore

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-15 15:07:58 +01:00
Joas Schilling e76ef9aaa8
Add a magic wrapper from hell to allow phpunit4 to run the code again
Remove this once phpunit 5 is the lowest supported version, by reverting:
https://github.com/nextcloud/server/pull/2137

Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-15 14:49:14 +01:00
Thomas Müller 506ccdbd8d
Introduce an event for first time login based on the last login time stamp
Use firstLogin event to trigger creation of default calendar and default address book

Delay login of admin user after setup so that firstLogin event can properly be processed for the admin

Fixing tests ...

Skeleton files are not copied over -> only 3 cache entries are remaining

Use updateLastLoginTimestamp to properly setup lastLogin value for a test user
2016-11-14 14:50:10 +01:00
Morris Jobke 16a110e803 Merge pull request #2067 from nextcloud/fileinfo-lazy-substorages
only query substorages to calculate the final mtime/size/etag when we need it
2016-11-14 11:39:02 +01:00
Lukas Reschke 7cb0df28e2
Prevent downgrade attacks for apps
We should verify the app versions when installing a new update, otherwise this could result in downgrade attacks when an attacker just copies the old signature.

Plus it prevents the case that in case of a bug in the appstore actually an older version gets installed.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-11 18:53:26 +01:00
Roeland Jago Douma 99ada40df4
Dispatch event on preview request
Fixes: #73

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-10 14:28:09 +01:00
Robin Appelman cbcdf69dc2
only query substorages to calculate the final mtime/size/etag lazily
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-10 13:59:22 +01:00
Christoph Wurst 0ebffa4a5f do not double encode the redirect url
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2016-11-09 16:14:46 +01:00
Lukas Reschke 9305094b8b
Add test and adjust PHP function arguments
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-09 10:49:57 +01:00
Joas Schilling 92e5fb4053
Add tests for validity of the definitions
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-09 10:08:29 +01:00
Joas Schilling 706b5c3fb6
Use a php class for the definitions to avoid loading problems
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-09 08:52:07 +01:00
Joas Schilling 4393e8003b
Make sure the database is not replaced while we make a backup of the service
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-08 16:32:41 +01:00
Roeland Jago Douma 04ece69a33
Cleanup OC_Group usage a bit
This is deprecated internal stuff. Should not be used anymore.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-04 20:55:47 +01:00
Lukas Reschke c0bbae28f0 Merge pull request #1741 from nextcloud/new_preview
Improve previews
2016-11-03 21:07:16 +01:00
Roeland Jago Douma 7ba7949dc1 Merge pull request #1994 from nextcloud/proper-cron-hints
Show a hint for system based cron user name
2016-11-03 14:11:37 +01:00
Roeland Jago Douma 87855aa97b
Added genertor helper & tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Roeland Jago Douma 2164085f22
Fix urlgenerator test
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Lukas Reschke b33ceb6fdd Merge pull request #1915 from nextcloud/downstream-26398
Add using casing check/fix for initMountPoints
2016-11-03 12:14:28 +01:00
Morris Jobke 0741346385
Show a hint for system based cron user name
* makes it easier to setup cron job
* gives hints for PHP documentation
* disables the cron setting if requirements not met
* fixes #1989

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2016-11-03 10:38:00 +01:00
Lukas Reschke 6920e609c0
Adjust tests and DI for Share.php
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-02 23:26:49 +01:00
Lukas Reschke 68cebef64c
DI for root.php
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-02 23:16:51 +01:00
Morris Jobke 39573e602d Merge pull request #1978 from nextcloud/remove-send-mail-option
Remove send mail option
2016-11-02 22:36:05 +01:00
Vincent Petry 889e0a574b
Fix mock warning in some FS tests (#26464) 2016-11-02 22:21:47 +01:00
Vincent Petry f737426eca
Add using casing check/fix for initMountPoints 2016-11-02 22:21:46 +01:00
Lukas Reschke c1feae1684 Merge pull request #1981 from nextcloud/multibucket-num-buckets
Allow setting a maximun number of buckets for multibucket
2016-11-02 22:05:57 +01:00
Robin Appelman 049bcae29e
Allow setting a maximun number of buckets for multibucket
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-11-02 21:31:24 +01:00
Lukas Reschke a8b7df9cc1
Add tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-02 21:10:51 +01:00
Joas Schilling 2c4035e806
Inject config and logger
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-11-02 20:30:37 +01:00
Morris Jobke e6b52ef4cd Merge pull request #1347 from nextcloud/bring-back-remember-me
fix remember me login
2016-11-02 18:32:38 +01:00
Bjoern Schiessle f556c58c22
remove 'send mail notification' option from sharing, replaced by send-by-mail feature
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-02 18:30:38 +01:00
Michael Grosser e81d04cd8d Merge pull request #1940 from nextcloud/new-appstore
Use new appstore API
2016-11-02 17:00:24 +00:00
Lukas Reschke 9d6e01ef40
Add missing tests and fix PHPDoc
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-11-02 13:39:17 +01:00
Christoph Wurst 6f86e468d4
inject ISecureRandom into user session and use injected config too
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2016-11-02 13:39:16 +01:00
Christoph Wurst d907666232
bring back remember-me
* try to reuse the old session token for remember me login
* decrypt/encrypt token password and set the session id accordingly
* create remember-me cookies only if checkbox is checked and 2fa solved
* adjust db token cleanup to store remembered tokens longer
* adjust unit tests

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2016-11-02 13:39:16 +01:00
Roeland Jago Douma 370123b8b0 Merge pull request #1966 from nextcloud/fix-csrf-token-generation
Fix CSRF token generation / validation
2016-11-02 12:09:30 +01:00
Leon Klingele e5d78a3523
Fix CSRF token generation / validation
Operate on raw bytes instead of base64-encoded strings.
Issue was introduced in a977465

Signed-off-by: Leon Klingele <git@leonklingele.de>
2016-11-02 10:38:05 +01:00
Bjoern Schiessle 318160647a
add method to check if a share provider for a given type is loaded
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
2016-11-01 19:54:39 +01:00
Roeland Jago Douma 7e2159e9bb
Add defaultShareProvider & federatedshareprovider tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-01 13:52:37 +01:00
Roeland Jago Douma d2110ebb0b
Add Manager unit tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-01 12:35:50 +01:00
Lukas Reschke 0eeef26a8e
Add tests for installer method
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-31 19:39:35 +01:00
Lukas Reschke 8acb54aa0b
Add update support
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-31 17:17:47 +01:00
Lukas Reschke 89fc4358ba
Use substr and explode instead of a regex
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-31 17:17:45 +01:00
Lukas Reschke 8d83e239f3
Fix tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-31 17:17:45 +01:00
Lukas Reschke 32cf661215
Use new appstore API
This change introduces the new appstore API in Nextcloud.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-31 17:17:44 +01:00
Robin Appelman 3692769b0a
Add getShareTypesInFolder to optimize folder listening
Signed-off-by: Robin Appelman <icewind@owncloud.com>
2016-10-31 15:55:40 +01:00
Roeland Jago Douma 83e7cfd13a
Fix more tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-28 22:16:28 +02:00
Roeland Jago Douma f722640a32
Proper DI of config
* Fixed comments

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-28 10:13:35 +02:00
Jörn Friedrich Dreyer f8352fcb8d
introduce callForSeenUsers and countSeenUsers (#26361)
* introduce callForSeenUsers and countSeenUsers

* add tests

* oracle should support not null on clob

* since 9.2.0
2016-10-28 08:44:05 +02:00
Morris Jobke d4969abc9d Merge pull request #1800 from nextcloud/nextcloud-rich-object-strings
Nextcloud rich object strings
2016-10-27 15:30:58 +02:00
Roeland Jago Douma b7046d390f
Remove internal share mail function
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-26 20:52:41 +02:00
Roeland Jago Douma b98dfaccd9 Merge pull request #1920 from nextcloud/legacy-pages-should-also-receive-the-nonce
Add nonce also to legacy CSP
2016-10-26 16:41:34 +02:00
Morris Jobke cde7f535bd Merge pull request #1738 from nextcloud/comments-provide-displaynames-with-mentions
comment mentions: show displayname not uid
2016-10-26 14:02:49 +02:00
Joas Schilling c20ab0049f
Identify Chromium as Chrome
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-26 12:07:10 +02:00
Roeland Jago Douma e351ba56f1
Move browserSupportsCspV3 to CSPNonceManager
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-25 22:03:10 +02:00
Morris Jobke 89574367bc Merge pull request #1871 from nextcloud/use-csp-nonces
Use CSP nonces
2016-10-25 14:46:00 +02:00
Lukas Reschke 740ff9108b Merge pull request #1884 from nextcloud/downstream-26292
Fix logClientIn for non-existing users (#26292)
2016-10-25 11:24:13 +02:00
Joas Schilling 890f752a6b Merge pull request #1452 from nextcloud/appconfig-endpoint
Appconfig endpoint
2016-10-25 10:57:48 +02:00
Roeland Jago Douma 593d52fe91
Fix and cleanup SessionTest
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-25 09:34:27 +02:00
Vincent Petry 6d1e858aa4
Fix logClientIn for non-existing users (#26292)
The check for two factor enforcement would return true for non-existing
users. This fix makes it return false in order to be able to perform
the regular login which will then fail and return false.

This prevents throwing PasswordLoginForbidden for non-existing users.
2016-10-25 09:34:27 +02:00
Lukas Reschke 38b3ac8213
Add ContentSecurityPolicyNonceManager
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-24 16:35:31 +02:00
Thomas Müller 03ec052b4e
App dependencies are now analysed on app enable as well - not only on app install. 2016-10-24 15:59:46 +02:00
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
Roeland Jago Douma ab91fa2660 Merge pull request #1820 from nextcloud/4byte-filenames
Allow 4byte unicode filenames on supported platforms
2016-10-24 10:38:25 +02:00
Roeland Jago Douma 7998689bc9
Added method to DB and fix test
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-24 09:45:04 +02:00
Roeland Jago Douma eaf152efeb
Fix DateTime comparisson
Datetime now returns microseconds. But if the database doesn't store
those comparing them for equality most likely fails.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-21 13:43:39 +02:00
Joas Schilling 0b1fb180a5
Make AppConfig part of the public API
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-21 09:09:23 +02:00
Morris Jobke 2799b0a821 Merge pull request #1835 from nextcloud/downstream-24948
Move OC\Files\Storage\Shared to the right namespace
2016-10-20 23:48:15 +02:00
Vincent Petry 9e9fef46d9
Get rid of very old oc:// stream wrapper (#26381) 2016-10-20 20:46:30 +02:00
Morris Jobke c7ba73e6f4 Merge pull request #1824 from nextcloud/downstream-26423
Ensure $commands being an array
2016-10-20 20:43:26 +02:00
Vincent Petry fca8bd44ab
Fix shared storage namespace in DecryptAll class 2016-10-20 20:36:50 +02:00
Joas Schilling 246bb9f33d
Move OC\Files\Storage\Shared to the right namespace 2016-10-20 20:27:44 +02:00
Thomas Müller ef842ef20a
Ensure $commands being an array - fixes #26073 2016-10-20 15:40:27 +02:00
Morris Jobke 7836a8d8c7
use short array syntax
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2016-10-20 15:40:22 +02:00
Joas Schilling 9f2d9895a5
Restore all services when a tests failed/finished for better testcase isolation
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-20 15:19:41 +02:00
Joas Schilling 122edcd0c1
Make sure all tests use the TestCase method to overwrite services
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-20 15:19:41 +02:00
Arthur Schiwon e5ce61b174
add missing methods to test fake manager
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2016-10-20 14:32:32 +02:00
Joas Schilling b35d2fd8f2
Allow rich object subjects for Notifications
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-20 12:14:59 +02:00
Joas Schilling 2098648850
Add Rich Object Definitions and a validator
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-20 12:14:51 +02:00
Arthur Schiwon 5d98ab83e9
resolve displayname via manager and registerable resolvers
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2016-10-19 00:34:00 +02:00
Arthur Schiwon fea3e20a80
move mention extraction to (I)Comment and report mentions via DAV
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2016-10-19 00:33:55 +02:00
Joas Schilling 303e073724
Do not skip when mysql uses utf8mb4
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-19 00:15:01 +02:00
Joas Schilling 43b7b143f4
Fix test of repair step
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-19 00:15:01 +02:00
Joas Schilling 17a2723948
Fix the test
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-19 00:15:01 +02:00
Morris Jobke 296a3274cf
only disable unicode test on mysql 2016-10-19 00:15:01 +02:00
Morris Jobke 972e560e72
Adding tests for 4 byte unicode characters
* success on SQLite and Postgres
* failure on MySQL due to the limited charset that only supports up to 3 bytes
2016-10-19 00:15:01 +02:00
Morris Jobke 96f8f209b9 Merge pull request #1449 from nextcloud/comments-user-mention
Notifications for simple @-mentioning in comments
2016-10-17 09:30:47 +02:00
Lukas Reschke 62e19dfa80 Merge pull request #1441 from nextcloud/getby-id-less-queries
optimize Folder::getById to use less queries
2016-10-14 15:18:23 +02:00
Christoph Wurst 53eb0f7f42 Merge pull request #1037 from nextcloud/no-double-token-update
dont update the auth token twice
2016-10-14 14:53:17 +02:00
Arthur Schiwon 1bcd2ca8e3
emit pre-update event for comments
* notifications can be cleaned up, no polluted DB
* updating comments will re-notify users or remove notifications, depending on the message

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2016-10-12 18:06:22 +02:00
Robin Appelman 0d842e0550
optimize Folder::getById to use less queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-10-12 16:12:28 +02:00
Roeland Jago Douma 7eba1d806b
Add tests for commands in info.xml
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-11 19:48:31 +02:00
Thomas Müller b1641cc113
Fix QueryBuilderTests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-11 12:30:46 +02:00
Robin Appelman 90db361827
Add test to ensure token times are updated
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-10-11 11:06:24 +02:00
Robin Appelman 25ed6714c7
dont update the auth token twice
Signed-off-by: Robin Appelman <robin@icewind.nl>
2016-10-11 11:05:25 +02:00
Roeland Jago Douma 3c173378e8
Fix typehint
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-10 22:13:51 +02:00
Thomas Müller 2806a4bca7
Cleanup test case
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-10 22:13:47 +02:00
Christoph Wurst a0cb809342 Merge pull request #1660 from nextcloud/add-notification-icon-to-api
Add an icon to the notification API
2016-10-10 09:32:34 +02:00
Morris Jobke 195fc041da Merge pull request #1663 from nextcloud/dont-reparse-info-xml
Dont reparse info xml + cache AppInfo XML
2016-10-10 09:22:43 +02:00
Christoph Wurst ce9e33bd3c Merge pull request #1656 from nextcloud/appinfo-check-class-existance
Make sure all the jobs, command, provides and migrations are valid
2016-10-10 09:04:27 +02:00
Lukas Reschke 0245dd7221
Simplify isSubDirectory check
Shaves off another 9ms per request as can be seen at https://blackfire.io/profiles/compare/dd54cef3-e58d-4a22-b8f4-c7c4b70697be/graph

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-07 21:56:43 +02:00
Lukas Reschke 0c2b17c80f
Cache AppInfo in Memory Cache if configured
This saves around 20ms on a bare-bone instance, on bigger ones more (depending on the number of installed apps).

See https://blackfire.io/profiles/compare/fc326ad3-100d-49b8-8ea9-8343240f53f3/graph

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-07 21:29:23 +02:00
Thomas Müller 67d3574bdf
Don't parse info.xml but reuse already cached app infos - fixes #25603 (#25968)
* Don't parse info.xml but reuse already cached app infos - fixes #25603

* Use === in InfoParser. Fixes test

* InfoParser should not depend on UrlGenerator - fixes issue with session being closed too early
2016-10-07 20:58:22 +02:00
Arthur Schiwon e1073cf442
Notificacations for simple @-mentioning in comments
(WIP) notify user when mentioned in comments

Fix doc, and create absolute URL for as notification link.

PSR-4 compatibility changes

also move notification creation to comments app

Do not notify yourself

unit test for controller and application

smaller fixes

- translatable app name
- remove doubles in mention array
- micro perf optimization
- display name: special label for deleted users, keep user id for users that could not be fetched from userManager

Comment Notification-Listener Unit Test

fix email adresses

remove notification when triggering comment was deleted

add and adjust tests

add missing @license tags

simplify NotificationsController registration

appinfo simplification, php docs

make string easier to translate

adjust test

replace dispatcher-based listeners with a registration method and interface

safer to not pass optional data parameter to setSubject for marking as processed. ID and mention suffices

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

update comment

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2016-10-07 17:11:19 +02:00
Joas Schilling c77933ca22
Add an icon to the notification API
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-07 17:00:24 +02:00
Joas Schilling c02a50a432
Make sure all the jobs, command, provides and migrations are valid
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-10-07 14:25:18 +02:00
Vincent Petry 626daabb56
Prefilter inaccessible shares in DefaultShareProvider::getSharedWith()
The DefaultShareProvider now does a DB-level check to find out whether
file_source is accessible at all (deleted file) or whether it's in the
trashbin of a home storage.

One small corner case where the home storage id is in md5 form cannot
be covered properly with this approach.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-06 13:57:58 +02:00
Lukas Reschke ea9b1cc340 Merge pull request #1306 from nextcloud/simplefs
Introducing AppData
2016-10-06 09:25:15 +02:00
Lukas Reschke a1f5364d7f
Generate coverage for quick DB tests
This adds the "QUICKDB" group which excludes some tests that abuse unit tests as integration tests as displayed in https://github.com/nextcloud/server/issues/1626

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-05 13:55:44 +02:00
Roeland Jago Douma 7512683ea9
Fix avatar tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-05 11:00:17 +02:00
Roeland Jago Douma 6807cb684f
avatar to appdata
* Fix AvatarTest

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-05 11:00:16 +02:00
Roeland Jago Douma ac38a3a654
Add Tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-10-05 11:00:16 +02:00
Christoph Wurst f27b7fa8d1
Do not use underscores in PSR4 namespaces of the backup codes app
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2016-10-03 21:47:33 +02:00
Lukas Reschke bf0371429c
Remove database requirement from test
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-10-03 14:15:18 +02:00
Lukas Reschke 341cd0ef61 Merge pull request #1582 from nextcloud/make-comments-100-tested
Add test for setTopmostParentId and getTopmostParentId
2016-09-30 01:04:29 +02:00
Lukas Reschke d5f39164a1
Add test for setTopmostParentId and getTopmostParentId
This wasn't tested before as proven by the coverage data.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-09-29 22:43:48 +02:00
Joas Schilling 4d1acfd4ef
Only trigger postDelete hooks when the user was deleted...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-09-29 15:40:53 +02:00
Joas Schilling f6ff60f4cb
Make sure that comments, notifications and preferences are deleted
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-09-29 15:40:53 +02:00
Morris Jobke 19f94ac5f9 Merge pull request #1549 from nextcloud/kill-update-simulation
Kill update simulation
2016-09-28 16:29:09 +02:00
Lukas Reschke c4d263199c Merge pull request #1521 from nextcloud/fix-mimetypedetect-hiddenfolder
Fix mimetype detection inside hidden folders (#26138)
2016-09-27 18:52:48 +02:00
Vincent Petry da0cea404d
Kill update simulation
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-09-27 18:43:53 +02:00
Joas Schilling 615b69677e
Use the same URL everywhere
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-09-27 14:52:22 +02:00
Joas Schilling 6f955defe4
Return the autoupdater value from the server
Signed-off-by: Joas Schilling <coding@schilljs.com>
2016-09-27 14:38:10 +02:00
Vincent Petry 9b4de310bd
Fix mimetype detection inside hidden folders (#26138)
Downstreaming of https://github.com/owncloud/core/pull/26138

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2016-09-26 11:31:03 +02:00
Roeland Jago Douma 6dace7f6ad
Add tests 2016-09-15 13:11:36 +02:00
Morris Jobke e39e1bdf4e Merge pull request #1395 from nextcloud/issue-369-htaccess-max-sizes
Make sure memory limit is > post size and upload filesize
2016-09-13 22:39:08 +02:00
Joas Schilling a3c8534b7b
Make sure memory limit is > post size and upload filesize 2016-09-13 16:50:36 +02:00
Joas Schilling db710e0b03
Make tests work with 4.8 at least 2016-09-13 16:31:33 +02:00
Roeland Jago Douma 368f407698
Fix getMock UtilTest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma d616984879
Fix getMock User 2016-09-13 09:09:53 +02:00
Roeland Jago Douma 478b86e5e5
Fix getMock UrlGeneratortest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma 2f36bbecb8
Fix getMock TagTest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma 1d166d645b
Fix getMock ManagerTest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma 7bc2d178ca
Fix getMock CertificateMangerTest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma 5aad530e6c
Fix getMock RepairUnmergedSharesTest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma cd5183dccc
Fix getMock DBLockingProviderTest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma dcf8091d69
Fix getMock HelperStorageTest 2016-09-13 09:09:53 +02:00
Roeland Jago Douma 31532ecf13
Fix getMock ViewTest 2016-09-13 09:09:52 +02:00
Roeland Jago Douma 5069b74f8b
Fix getMock scannertest 2016-09-13 09:09:52 +02:00
Roeland Jago Douma d277053f22
Fix getMock QuotaTest 2016-09-13 09:09:52 +02:00
Roeland Jago Douma fe15dccb45
Fix getMock FolderTests 2016-09-13 09:09:52 +02:00
Roeland Jago Douma d77982c03f
Fix getMock UserMountcacheTest 2016-09-13 09:09:52 +02:00
Roeland Jago Douma 4b8d474ec5
Fix getMock Cache 2016-09-13 09:09:52 +02:00
Roeland Jago Douma 3782edf49c
Fix getMock DecryptAllTest 2016-09-13 09:09:52 +02:00
Roeland Jago Douma 16e88a7ebf
Fix getMock ManagerTest 2016-09-13 09:09:52 +02:00