Commit Graph

9099 Commits

Author SHA1 Message Date
Lukas Reschke 4dfdaf741c Merge pull request #15834 from owncloud/make-temporary-file-really-unique
Fix collision on temporary files + adjust permissions
2015-04-25 23:18:26 +02:00
Lukas Reschke b9df932e3c Merge pull request #15683 from owncloud/block-legacy-clients
Block old legacy clients
2015-04-24 18:21:10 +02:00
Bjoern Schiessle 9a5783b284 fix unit tests 2015-04-24 16:47:27 +02:00
jknockaert 49df8ef525 Update encryption.php 2015-04-24 16:44:00 +02:00
jknockaert 238302ee7d fixed name 2015-04-24 16:44:00 +02:00
jknockaert 1756562501 Update encryption.php 2015-04-24 16:44:00 +02:00
jknockaert 735f6cc037 fix encryption header error
When moving back the pointer to position 0 (using stream_seek), the pointer on the encrypted stream will be moved to the position immediately after the header. Reading the header again (invoked by stream_read) will cause an error, writing the header again (invoked by stream_write) will corrupt the file. Reading/writing the header should therefore happen when opening the file rather than upon read or write. Note that a side-effect of this PR is that empty files will still get an encryption header; I think that is OK, but it is different from how it was originally implemented.
2015-04-24 16:43:16 +02:00
Joas Schilling 4334e77035 Merge pull request #15839 from owncloud/enc_fix_moving_shared_files
[encryption] fix moving files to a shared folder
2015-04-24 15:07:36 +02:00
Joas Schilling 1592be117a Use public interfaces for type hinting 2015-04-24 13:06:03 +02:00
Bjoern Schiessle 24128d1384 only update share keys if the file was encrypted 2015-04-24 10:19:09 +02:00
Bjoern Schiessle 2646bccb83 update share keys if file gets copied 2015-04-23 17:18:48 +02:00
Bjoern Schiessle 2990b0e07e update share keys if a file is moved to a shared folder 2015-04-23 17:18:48 +02:00
Thomas Müller b1bb6a3d36 Ignore test folders when checking the code for compliance 2015-04-23 16:59:26 +02:00
Lukas Reschke ab9ea97d3a Catch not existing User-Agent header
In case of an not sent UA header consider the client as valid
2015-04-23 16:33:51 +02:00
Lukas Reschke 155ae44bc6 Fix collision on temporary files + adjust permissions
This changeset hardens the temporary file and directory creation to address multiple problems that may lead to exposure of files to other users, data loss or other unexpected behaviour that is impossible to debug.

**[CWE-668: Exposure of Resource to Wrong Sphere](https://cwe.mitre.org/data/definitions/668.html)**
The temporary file and folder handling as implemented in ownCloud is performed using a MD5 hash over `time()` concatenated with `rand()`. This is insufficiently and leads to the following security problems:
The generated filename could already be used by another user. It is not verified whether the file is already used and thus temporary files might be used for another user as well resulting in all possible stuff such as "user has file of other user".

Effectively this leaves us with:

1. A timestamp based on seconds (no entropy at all)
2. `rand()` which returns usually a number between 0 and 2,147,483,647

Considering the birthday paradox and that we use this method quite often (especially when handling external storage) this is quite error prone and needs to get addressed.

This behaviour has been fixed by using `tempnam` instead for single temporary files. For creating temporary directories an additional postfix will be appended, the solution is for directories still not absolutely bulletproof but the best I can think about at the moment. Improvement suggestions are welcome.

**[CWE-378: Creation of Temporary File With Insecure Permissions](https://cwe.mitre.org/data/definitions/378.html)**

Files were created using `touch()` which defaults to a permission of 0644. Thus other users on the machine may read potentially sensitive information as `/tmp/` is world-readable. However, ownCloud always encourages users to use a dedicated machine to run the ownCloud instance and thus this is no a high severe issue. Permissions have been adjusted to 0600.

**[CWE-379: Creation of Temporary File in Directory with Incorrect Permissions](https://cwe.mitre.org/data/definitions/379.html)**

Files were created using `mkdir()` which defaults to a permission of 0777. Thus other users on the machine may read potentially sensitive information as `/tmp/` is world-readable. However, ownCloud always encourages users to use a dedicated machine to run the ownCloud instance and thus this is no a high severe issue. Permissions have been adjusted to 0700.Please enter the commit message for your changes.
2015-04-23 15:07:54 +02:00
Jenkins for ownCloud f8f354b351 [tx-robot] updated from transifex 2015-04-23 01:54:51 -04:00
Lukas Reschke ed0b465cf9 Use 403 instead a 50x response 2015-04-20 12:53:40 +02:00
Lukas Reschke 4ea205e262 Block old legacy clients
This Pull Request introduces a SabreDAV plugin that will block all older clients than 1.6.1 to connect and sync with the ownCloud instance.

This has multiple reasons:

1. Old ownCloud client versions before 1.6.0 are not properly working with sticky cookies for load balancers and thus generating sessions en masse
2. Old ownCloud client versions tend to be horrible buggy

In some cases we had in 80minutes about 10'000 sessions created by a single user. While this change set does not really "fix" the problem as 3rdparty legacy clients are affected as well, it is a good work-around and hopefully should force users to update their client
2015-04-20 11:12:17 +02:00
Morris Jobke 9cb260d310 Merge pull request #15717 from owncloud/issue/15716-fixing-ocp-api-namespace-usage
Fixing OCS API namespace usage
2015-04-20 09:43:19 +02:00
Jenkins for ownCloud 75bf03a605 [tx-robot] updated from transifex 2015-04-20 01:54:44 -04:00
Morris Jobke d4ac7ac723 Merge pull request #15739 from DavidPrevot/symfony-2.7
Replace `_method` requirement by {g,s}etMethods()
2015-04-19 23:46:21 +02:00
Georg Ehrke 8f51efc49e get rid of OC_Geo 2015-04-19 20:16:56 +02:00
David Prévot 7f2f92847b Replace `_method` requirement by {g,s}etMethods()
Make the call compatible with future Symfony version, and avoid
E_USER_DEPRECATED as thrown by the current 2.7.0-beta1:

The "_method" requirement is deprecated since version 2.2 and will be
removed in 3.0. Use getMethods() instead. at
…/Symfony/Component/Routing/Route.php#554

The "_method" requirement is deprecated since version 2.2 and will be
removed in 3.0. Use the setMethods() method instead or the "methods"
option in the route definition. at
…/Symfony/Component/Routing/Route.php#662
2015-04-19 12:08:29 -04:00
Roeland Douma d877c1f1e1 Merge pull request #15736 from owncloud/remove-dependency-on-legacy-code-in-ocp
Reduce call of legacy wrapper by call the OCP directly
2015-04-19 15:42:07 +02:00
Roeland Douma 3cb5dd68e6 Merge pull request #15737 from owncloud/add-deprecated-version
Add version to @deprecated tags
2015-04-19 15:40:53 +02:00
Robin McCorkell 80b892e7ed Merge pull request #15729 from owncloud/remove-unused-variables
Remove unused variables
2015-04-19 12:38:29 +01:00
Jenkins for ownCloud fd3c1484ad [tx-robot] updated from transifex 2015-04-19 01:54:41 -04:00
Morris Jobke c056c52010 Add version to @deprecated tags 2015-04-19 01:04:59 +02:00
Morris Jobke 9b8ebdadf7 Reduce call of legacy wrapper by call the OCP directly
* ref #15734
* reduces the call depth, because the private methods just call OCP stuff
2015-04-19 00:29:09 +02:00
Morris Jobke f6807337a8 Add @since tag to public namespace constants 2015-04-18 23:19:35 +02:00
Thomas Müller cdf82909b8 Merge pull request #15718 from owncloud/issue/15694-display-name-of-encryption-modules
Issue/15694 display name of encryption modules
2015-04-18 22:51:15 +02:00
Thomas Müller b7a4972218 Merge pull request #15728 from owncloud/update-iurlgenerator-doc
IUrlGenerator - document linkTo properly
2015-04-18 22:48:09 +02:00
Thomas Müller d2a31bcd93 Merge pull request #15727 from owncloud/cleanup-db-interface
DB: remove unused parameter - was forgotten during the migration to doct...
2015-04-18 22:47:40 +02:00
Thomas Müller c922b09f26 Merge pull request #15725 from owncloud/l10n-public-interface
IL10n - add PHPDoc for $options
2015-04-18 22:46:50 +02:00
Morris Jobke e837927ad5 fix followup issues with unneeded parameters 2015-04-18 17:02:39 +02:00
Morris Jobke ccf47f40aa Remove unused variables
* should make scrutinizer a lot more happy
* reduces maybe memory footprint
2015-04-18 16:35:19 +02:00
Morris Jobke eb62e7cc27 IUrlGenerator - document linkTo properly
* parameter $args was there since 6.0.0
* see 61a9098b7d
2015-04-18 16:03:37 +02:00
Morris Jobke 47ecfd98a3 DB: remove unused parameter - was forgotten during the migration to doctrine
* 377e9a8677 <- doctrine merge
2015-04-18 15:57:13 +02:00
Morris Jobke 9ffac12986 IL10n - add PHPDoc for $options
* added in #11549
* undocumented in the public interface
2015-04-18 15:50:17 +02:00
Morris Jobke f72dabb4eb fix wrong variable names in PHPDoc 2015-04-18 14:31:28 +02:00
Morris Jobke 11f29f6d95 add visibility of methods in server container and interface 2015-04-18 14:19:22 +02:00
Joas Schilling 3f3f8c2f99 Fix usage of deprecated private constants 2015-04-18 10:30:02 +02:00
Joas Schilling 4d238c3949 Fix display name of encryption modules 2015-04-18 10:18:58 +02:00
Joas Schilling 6ce1abfa5c Deprecate the OC_API constants in favor of the OCP ones 2015-04-18 09:29:52 +02:00
Joas Schilling 4e58f4892a Move constants to OCP\API so apps can use them 2015-04-18 09:29:51 +02:00
Joas Schilling 8cb0d97b10 Merge pull request #15692 from owncloud/log-exception-type-master
Write the type of exception to the log - really helpful for exceptions w...
2015-04-18 09:28:48 +02:00
Joas Schilling 5acda185bd Correctly prefix OC_API with \ since its not in the namespace 2015-04-18 09:12:42 +02:00
Jenkins for ownCloud 37a871127b [tx-robot] updated from transifex 2015-04-18 01:55:19 -04:00
Morris Jobke 7ab1f807fb Merge pull request #15691 from owncloud/vobject-sabre2.1
Get rid of the obsolete OC_VObject class
2015-04-17 22:33:00 +02:00
Thomas Müller d9990c2b4e Delay initialization of the OC\Encryption\Update - introducing 'OC\Encryption\HookManager' 2015-04-17 13:55:31 +02:00