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

[Bug]: occ does not take escaping into account that is handed over for whitespaces in path #45226

Closed
6 of 8 tasks
vacy opened this issue May 7, 2024 · 2 comments
Closed
6 of 8 tasks
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug

Comments

@vacy
Copy link

vacy commented May 7, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

occ files:scan -p "user/files/path\ to\ file" is telling me the path user/files/path does not exist

Steps to reproduce

  1. I need to rename some files, thatfor i want to call occ files:scan on the renamed files
  2. i run: occ files:scan -p "user/files/path\ to\ file"
  3. occ tells me: user/files/path not found

Expected behavior

it should go and inspect the path including the whitespaces given in the parameter

Installation method

Community Manual installation with Archive

Nextcloud Server version

28

Operating system

RHEL/CentOS

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
REMOVED SENSITIVE VALUE
        ],
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/domain.tld\/nextcloud",
        "dbtype": "mysql",
        "version": "28.0.5.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "maintenance": false,
        "share_folder": "\/inbox\/shares",
        "ldapIgnoreNamingRules": false,
        "appstore.experimental.enabled": true,
        "mail_smtpmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "has_internet_connection": true,
        "check_for_working_webdav": true,
        "check_for_working_wellknown_setup": true,
        "check_for_working_htaccess": true,
        "enable_previews": true,
        "preview_max_x": 2048,
        "preview_max_y": 2048,
        "preview_max_scale_factor": 10,
        "theme": "",
        "htaccess.RewriteBase": "\/nextcloud",
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "updater.release.channel": "stable",
        "loglevel": 0,
        "auth.bruteforce.protection.enabled": false,
        "debug": false,
        "log_query": false,
        "mysql.utf8mb4": true,
        "has_rebuilt_cache": true,
        "default_phone_region": "..",
        "data-fingerprint": "...",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "maintenance_window_start": 1
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - analytics: 4.13.0
  - audioplayer: 3.4.1
  - bookmarks: 14.0.2
  - calendar: 4.7.2
  - cloud_federation_api: 1.11.0
  - contacts: 5.5.3
  - contactsinteraction: 1.9.0
  - cookbook: 0.11.0
  - dashboard: 7.8.0
  - dav: 1.29.1
  - deck: 1.12.2
  - duplicatefinder: 1.1.8
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_automatedtagging: 1.18.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - impersonate: 1.15.0
  - integration_openai: 2.0.1
  - lookup_server_connector: 1.16.0
  - notes: 4.10.0
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - phonetrack: 0.8.1
  - photos: 2.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - survey_client: 1.16.0
  - systemtags: 1.18.0
  - text: 3.9.1
  - theming: 2.3.0
  - theming_customcss: 1.16.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - user_ldap: 1.19.0
  - user_migration: 5.0.0
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflow_media_converter: 1.10.3
  - workflow_pdf_converter: 1.13.0
  - workflowengine: 2.10.0
Disabled:
  - admin_audit: 1.18.0 (installed 1.10.0)
  - bruteforcesettings: 2.8.0 (installed 1.0.2)
  - circles: 28.0.0 (installed 0.12.4)
  - comments: 1.18.0 (installed 1.10.0)
  - encryption: 2.16.0
  - files_external: 1.20.0 (installed 1.17.0)
  - logreader: 2.13.0 (installed 2.5.0)
  - nextcloud_announcements: 1.17.0 (installed 1.14.0)
  - support: 1.11.1 (installed 1.5.0)
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2
  - user_status: 1.8.1 (installed 1.2.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

↳ tail -n0 -f nextcloud.log | jq . &
↳ occ files:scan --path="user/files/media/own/2017-05 - Rumaenien/177-2017-05-08T00:45:30.JPG"
{
  "reqId": "...",
  "level": 1,
  "time": "2024-05-07T21:28:09+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "files",
  "method": "",
  "url": "--",
  "message": "Completed scan of 0 files in 0 folder. Found 0 new, 0 updated and 0 removed items",
  "userAgent": "--",
  "version": "28.0.5.1",
  "data": {
    "app": "files"
  }
}

Starting scan for user 1 out of 1 (user)
Path not found: /user/files/media/own/2017-05 "<--------------"
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 0       | 0     | 0   | 0       | 0       | 1      | 00:00:00     |
+---------+-------+-----+---------+---------+--------+--------------+

↳ occ files:scan --path="user/files/media/own/2017-05\ - Rumaenien/177-2017-05-08T00:45:30.JPG"
{
  "reqId": "...",
  "level": 1,
  "time": "2024-05-07T21:28:20+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "files",
  "method": "",
  "url": "--",
  "message": "Completed scan of 0 files in 0 folder. Found 0 new, 0 updated and 0 removed items",
  "userAgent": "--",
  "version": "28.0.5.1",
  "data": {
    "app": "files"
  }
}
07.05.2024 23:28:25

Starting scan for user 1 out of 1 (user)
Path not found: /user/files/media/own/2017-05</error>  "<--------------"
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 0       | 0     | 0   | 0       | 0       | 1      | 00:00:00     |
+---------+-------+-----+---------+---------+--------+--------------+

Additional info

No response

@vacy vacy added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels May 7, 2024
@small1
Copy link

small1 commented May 8, 2024

I cant reproduce this. With escapes, with quotes, with just a dir or a direct file.

on nc28:
sudo -u www-data php occ files:scan --path="admin/files/Demo/New folder - with space/"
Starting scan for user 1 out of 1 (admin)
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 1 | 1 | 0 | 0 | 0 | 0 | 00:00:00 |
+---------+-------+-----+---------+---------+--------+--------------+

On nc29:
sudo -u www-data php occ files:scan --path="admin/files/New folder - demo/"
Starting scan for user 1 out of 1 (admin)
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 1 | 1 | 0 | 0 | 0 | 0 | 00:00:00 |
+---------+-------+-----+---------+---------+--------+--------------

If i remove " and escape spaces and dash result is the same.

@vacy
Copy link
Author

vacy commented May 8, 2024

my bad, i aliased it in a buggy way. thanks for headsup @small1

function occ { /bin/php -d apc.enable_cli=1 -f ~/pub/nextcloud//occ -- $@ ; }

right way to do is:
function occ { /bin/php -d apc.enable_cli=1 -f ~/pub/nextcloud//occ -- "$@" ; }

@vacy vacy closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug
Projects
None yet
Development

No branches or pull requests

2 participants