Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupt encrypted files cannot be deleted anymore #3579

Closed
BlackEdder0815 opened this issue Feb 22, 2017 · 5 comments · Fixed by #3841
Closed

Corrupt encrypted files cannot be deleted anymore #3579

BlackEdder0815 opened this issue Feb 22, 2017 · 5 comments · Fixed by #3841

Comments

@BlackEdder0815
Copy link

Steps to reproduce

  1. create an encrypted file (on an external storage)
  2. modify this file directly (not through nextcloud) or provoke a corrupt write of the file
  3. The file cannot opened by nextcloud anymore
  4. The file cannot be deleted anymore (while trashbin-app is activated)

Expected behaviour

The corrupt file can be deleted, to clean-up the corrupted files.

Actual behaviour

There is no way to delete this file or the parent directory. (with activated trashbin-app)

Server configuration

Operating system: debian

Web server: unknown

Database: mysql

PHP version: 7.0.14

Nextcloud version: 11.0.1

Updated from an older Nextcloud/ownCloud or fresh install:
update from 11.0.0

Where did you install Nextcloud from:
setup-script, downloaded by nextcloud

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
 [2] =>   - activity: 2.4.1
    [3] =>   - audioplayer: 1.4.1
    [4] =>   - calendar: 1.5.0
    [5] =>   - comments: 1.1.0
    [6] =>   - contacts: 1.5.3
    [7] =>   - dav: 1.1.1
    [8] =>   - encryption: 1.4.1
    [9] =>   - federatedfilesharing: 1.1.1
    [10] =>   - federation: 1.1.1
    [11] =>   - files: 1.6.1
    [12] =>   - files_external: 1.1.2
    [13] =>   - files_external_acd: 0.1.3
    [14] =>   - files_pdfviewer: 1.0.1
    [15] =>   - files_sharing: 1.1.1
    [16] =>   - files_texteditor: 2.2
    [17] =>   - files_versions: 1.4.0
    [18] =>   - files_videoplayer: 1.0.0
    [19] =>   - firstrunwizard: 2.0
    [20] =>   - gallery: 16.0.0
    [21] =>   - logreader: 2.0.0
    [22] =>   - lookup_server_connector: 1.0.0
    [23] =>   - mail: 0.6.2
    [24] =>   - nextcloud_announcements: 1.0
    [25] =>   - notifications: 1.0.1
    [26] =>   - password_policy: 1.1.0
    [27] =>   - provisioning_api: 1.1.0
    [28] =>   - serverinfo: 1.1.1
    [29] =>   - sharebymail: 1.0.1
    [30] =>   - survey_client: 0.1.5
    [31] =>   - systemtags: 1.1.3
    [32] =>   - theming: 1.1.1
    [33] =>   - twofactor_backupcodes: 1.0.0
    [34] =>   - updatenotification: 1.1.1
    [35] =>   - workflowengine: 1.1.1

The content of config/config.php:

Config report
$CONFIG = array (
'instanceid' => 'xxx',
'passwordsalt' => 'xxx',
'secret' => 'xxx',
'trusted_domains' =>
array (
0 => 'xxx',
),
'datadirectory' => '/www/htdocs/xxx/cloud/data',
'overwrite.cli.url' => 'https://xxx',
'dbtype' => 'mysql',
'version' => '11.0.1.2',
'dbname' => 'xxx',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'xxx',
'dbpassword' => 'xxx',
'logtimezone' => 'UTC',
'installed' => true,
'enable_previews' => true,
'preview_max_x' => 1024,
'preview_max_y' => 1024,
'preview_max_scale_factor' => 10,
'preview_max_filesize_image' => 50,
'preview_libreoffice_path' => '/usr/bin/libreoffice',
'preview_office_cl_parameters' => ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ',
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\PNG',
1 => 'OC\\Preview\\JPEG',
2 => 'OC\\Preview\\GIF',
3 => 'OC\\Preview\\BMP',
4 => 'OC\\Preview\\XBitmap',
5 => 'OC\\Preview\\TXT',
6 => 'OC\\Preview\\MarkDown',
),
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'tempdirectory' => '/www/htdocs/xxx/cloud/data/tmp/',
);

Are you using external storage, if yes which one: acd

Are you using encryption: yes

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox

Operating system: Windows 7

Logs

Web server error log

Web server error log
no access to this log

Nextcloud log (data/nextcloud.log)

Nextcloud log
> 	OC\HintException: Bad Signature
> /www/htdocs/w015300e/cloud/apps/encryption/lib/Crypto/Crypt.php - line 464: OCA\Encryption\Crypto\Crypt->checkSignature('OfpNiCWq3LdUZ0t...', 't\x06R\xDB\x88\x92\x17\x92\x84\xD5\xD7\x19\xB4\x1ED...', '67eaa49887ea0a3...')
> /www/htdocs/w015300e/cloud/apps/encryption/lib/Crypto/Encryption.php - line 372: OCA\Encryption\Crypto\Crypt->symmetricDecryptFileContent('OfpNiCWq3LdUZ0t...', 't\x06R\xDB\x88\x92\x17\x92\x84\xD5\xD7\x19\xB4\x1ED...', 'AES-256-CTR', 0, 0)
> /www/htdocs/w015300e/cloud/lib/private/Files/Stream/Encryption.php - line 460: OCA\Encryption\Crypto\Encryption->decrypt('OfpNiCWq3LdUZ0t...', 0)
> /www/htdocs/w015300e/cloud/lib/private/Files/Stream/Encryption.php - line 291: OC\Files\Stream\Encryption->readCache()
> [internal function] OC\Files\Stream\Encryption->stream_read(8192)
> /www/htdocs/w015300e/cloud/lib/private/legacy/helper.php - line 296: fread(Resource id #1046, 8192)
> /www/htdocs/w015300e/cloud/lib/private/Files/Storage/Wrapper/Encryption.php - line 745: OC_Helper streamCopy(Resource id #1046, Resource id #1047)
> /www/htdocs/w015300e/cloud/lib/private/Files/Storage/Wrapper/Encryption.php - line 642: OC\Files\Storage\Wrapper\Encryption->copyBetweenStorage(Object(OCA\Files_Trashbin\Storage), 'Musik/Sunshine ...', 'files_trashbin/...', false, true)
> /www/htdocs/w015300e/cloud/lib/private/Files/Storage/Wrapper/Encryption.php - line 737: OC\Files\Storage\Wrapper\Encryption->copyFromStorage(Object(OCA\Files_Trashbin\Storage), 'Musik/Sunshine ...', 'files_trashbin/...', false, true)
> /www/htdocs/w015300e/cloud/lib/private/Files/Storage/Wrapper/Encryption.php - line 614: OC\Files\Storage\Wrapper\Encryption->copyBetweenStorage(Object(OCA\Files_Trashbin\Storage), 'Musik/Sunshine ...', 'files_trashbin/...', true, true)
> /www/htdocs/w015300e/cloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 569: OC\Files\Storage\Wrapper\Encryption->moveFromStorage(Object(OCA\Files_Trashbin\Storage), 'Musik/Sunshine ...', 'files_trashbin/...')
> /www/htdocs/w015300e/cloud/apps/files_trashbin/lib/Trashbin.php - line 237: OC\Files\Storage\Wrapper\Wrapper->moveFromStorage(Object(OCA\Files_Trashbin\Storage), 'Musik/Sunshine ...', 'files_trashbin/...')
> /www/htdocs/w015300e/cloud/apps/files_trashbin/lib/Storage.php - line 161: OCA\Files_Trashbin\Trashbin move2trash('ACD/Musik/Sunsh...')
> /www/htdocs/w015300e/cloud/apps/files_trashbin/lib/Storage.php - line 107: OCA\Files_Trashbin\Storage->doDelete('Musik/Sunshine ...', 'rmdir')
> /www/htdocs/w015300e/cloud/lib/private/Files/View.php - line 1124: OCA\Files_Trashbin\Storage->rmdir('Musik/Sunshine ...')
> /www/htdocs/w015300e/cloud/lib/private/Files/View.php - line 345: OC\Files\View->basicOperation('rmdir', '/ACD/Musik/Suns...', Array)
> /www/htdocs/w015300e/cloud/apps/dav/lib/Connector/Sabre/Directory.php - line 277: OC\Files\View->rmdir('/ACD/Musik/Suns...')
> /www/htdocs/w015300e/cloud/3rdparty/sabre/dav/lib/DAV/Tree.php - line 179: OCA\DAV\Connector\Sabre\Directory->delete()
> /www/htdocs/w015300e/cloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 287: Sabre\DAV\Tree->delete('ACD/Musik/Sunsh...')
> [internal function] Sabre\DAV\CorePlugin->httpDelete(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
> /www/htdocs/w015300e/cloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
> /www/htdocs/w015300e/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method DELETE', Array)
> /www/htdocs/w015300e/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
> /www/htdocs/w015300e/cloud/apps/dav/appinfo/v1/webdav.php - line 60: Sabre\DAV\Server->exec()
> /www/htdocs/w015300e/cloud/remote.php - line 165: require_once('/www/htdocs/w01...')
> {main}```
</details>

#### Browser log
<details>
<summary>Browser log</summary>

nothing relevant

</details>
@BlackEdder0815
Copy link
Author

@nickvergessen
Copy link
Member

@schiessle

@schiessle
Copy link
Member

I just tried it but couldn't reproduce it. Is there anything else worth mentioning? Is the file (parent folder) shared? Do you use external storages?

@schiessle
Copy link
Member

@BlackEdder0815 even if I couldn't reproduce it completely (I could trigger a error message in case of shared files but the file was still deleted) I have a idea what caused the problem. This PR should fix it, maybe you can test it: #3841

@BlackEdder0815
Copy link
Author

Sounds good, thank you. I check this out, when it will be released with the next version.
The code-change looks quite good.
Thank you for the fix!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants