nextcloud / nextcloud/files_antivirus

Files containing spaces not scanned

Open
#133 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
112
Forks
44
Avg merge
1d 6h
Merged PRs (30d)
20

Description

Hi,

seems files_antivirus cannot scan files with spaces. This is what our logs contain

Fatal	files_antivirus	OCA\Files_Antivirus\BackgroundJob\BackgroundScanner::run, exception:
Fatal	files_antivirus	Can not open for reading. File: 92161Account: xxx.xxx Path: /xxx.xxx/files/Vorschlag XXXXXXXXXX YYY-ZZZ.pdf
Error	PHP	fopen(/var/www/nextcloud/data/xxx.xxx/files/Vorschlag XXXXXXXXXX YYY-ZZZ.pdf): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#301

The file does exist at that location.

Server configuration

Operating system:
Linux

Web server:
Apache

Database:
MySQL

PHP version:
PHP 7.2.15-0ubuntu0.18.04.1

Nextcloud version: (see Nextcloud admin page)
16.0.4

List of activated apps:

Enabled:
  - accessibility: 1.2.0
  - bruteforcesettings: 1.4.0
  - calendar: 1.7.1
  - cloud_federation_api: 0.2.0
  - dav: 1.9.2
  - federatedfilesharing: 1.6.0
  - federation: 1.6.0
  - files: 1.11.0
  - files_antivirus: 2.1.1
  - files_external: 1.7.0
  - files_sharing: 1.8.0
  - impersonate: 1.3.0
  - logreader: 2.1.0
  - lookup_server_connector: 1.4.0
  - nextcloud_announcements: 1.5.0
  - notifications: 2.4.1
  - oauth2: 1.4.2
  - password_policy: 1.6.0
  - privacy: 1.0.0
  - provisioning_api: 1.6.0
  - recommendations: 0.4.0
  - serverinfo: 1.6.0
  - sharebymail: 1.6.0
  - theming: 1.7.0
  - twofactor_backupcodes: 1.5.0
  - updatenotification: 1.6.0
  - viewer: 1.1.0
  - workflowengine: 1.6.0
Disabled:
  - activity
  - admin_audit
  - comments
  - encryption
  - files_pdfviewer
  - files_rightclick
  - files_texteditor
  - files_trashbin
  - files_versions
  - files_videoplayer
  - firstrunwizard
  - gallery
  - support
  - survey_client
  - systemtags
  - user_ldap

Nextcloud configuration:

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "xxxxxxx.de"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "version": "16.0.4.1",
        "dbtype": "mysql",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "installed": true,
        "default_language": "de",
        "defaultapp": "files",
        "knowledgebaseenabled": true,
        "enable_avatars": true,
        "allow_user_to_change_display_name": true,
        "remember_login_cookie_lifetime": 1296000,
        "session_lifetime": 86400,
        "session_keepalive": true,
        "skeletondirectory": "",
        "user_backends": [],
        "lost_password_link": "",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpdebug": false,
        "mail_smtpmode": "sendmail",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtptimeout": 10,
        "mail_smtpauthtype": "LOGIN",
        "overwritehost": "www.xxxxxxx.de",
        "overwriteprotocol": "https",
        "overwritewebroot": "\/cloud",
        "overwritecondaddr": "",
        "overwrite.cli.url": "https:\/\/www.xxxxxxx.de\/cloud",
        "trashbin_retention_obligation": "auto",
        "versions_retention_obligation": "auto",
        "appcodechecker": false,
        "updatechecker": true,
        "has_internet_connection": true,
        "check_for_working_webdav": true,
        "check_for_working_htaccess": true,
        "htaccess.RewriteBase": "\/cloud",
        "config_is_read_only": false,
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud.log",
        "loglevel": 2,
        "syslog_tag": "nextcloud",
        "log.condition": {
            "shared_secret": "***REMOVED SENSITIVE VALUE***",
            "users": [
                "sample-user"
            ],
            "apps": [
                "files"
            ]
        },
        "logdateformat": "F d, Y H:i:s",
        "logtimezone": "Europe\/Berlin",
        "log_query": false,
        "cron_log": true,
        "cron.lockfile.location": "\/tmp",
        "log_rotate_size": false,
        "3rdpartyroot": "",
        "3rdpartyurl": "",
        "customclient_desktop": "https:\/\/nextcloud.com\/install\/#install-clients",
        "customclient_android": "https:\/\/play.google.com\/store\/apps\/details?id=com.nextcloud.client",
        "customclient_ios": "https:\/\/itunes.apple.com\/us\/app\/nextcloud\/id1125420102?mt=8",
        "appstoreenabled": true,
        "appstore.experimental.enabled": false,
        "apps_paths": [
            {
                "path": "\/var\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": true
            }
        ],
        "enable_previews": true,
        "preview_max_x": 2048,
        "preview_max_y": 2048,
        "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": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "ldapUserCleanupInterval": 51,
        "maintenance": false,
        "singleuser": false,
        "openssl": [],
        "filelocking.enabled": true,
        "memcache.local": "\\OC\\Memcache\\ArrayCache",
        "memcache.distributed": "",
        "cache_path": "",
        "dbdriveroptions": {
            "1002": "SET wait_timeout = 28800"
        },
        "sqlite.journal_mode": "DELETE",
        "supportedDatabases": [
            "sqlite",
            "mysql",
            "pgsql",
            "oci"
        ],
        "tempdirectory": "\/var\/www\/nextcloud\/data\/tmp",
        "hashingCost": 10,
        "blacklisted_files": [
            ".htaccess"
        ],
        "share_folder": "\/",
        "theme": "",
        "cipher": "AES-256-CFB",
        "minimum.supported.desktop.version": "1.7.0",
        "quota_include_external_storage": false,
        "filesystem_check_changes": 0,
        "part_file_in_storage": true,
        "asset-pipeline.enabled": false,
        "assetdirectory": "\/var\/www\/nextcloud",
        "mount_file": "\/var\/www\/nextcloud\/data\/mount.json",
        "filesystem_cache_readonly": false,
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED",
            "HTTP_FORWARDED_FOR"
        ],
        "max_filesize_animated_gifs_public_sharing": 10,
        "debug": false,
        "integrity.check.disabled": true,
        "mail_sendmailmode": "smtp",
        "mysql.utf8mb4": true,
        "updater.release.channel": "stable",
        "app_install_overwrite": [
            "calendar"
        ]
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at OCA\Files_Antivirus\BackgroundJob\BackgroundScanner::run and inspect the file-opening path, then compare it with nextcloud/lib/private/Files/Storage/Local.php around line 301. Reproduce the failure with a file whose name contains spaces; done means the antivirus scan opens and processes that file successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.