nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.69k stars 4k forks source link

[Bug]: Setting the background image with occ invalidates the integrity check #36654

Open muckelba opened 1 year ago

muckelba commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

I've followed the docs on how to configure theming with occ and set a background image, but after doing that the integrity check fails because of a new file:

Results
=======
- theming
    - EXTRA_FILE
        - background/background.jpg

Raw output
==========
Array
(
    [theming] => Array
        (
            [EXTRA_FILE] => Array
                (
                    [background/background.jpg] => Array
                        (
                            [expected] => 
                            [current] => 478f1342d1f9940b722668306a6150d01ddbe5562c28b6045b378882895c139a36817eab2dadb6b2ee5c4501970df5c131f2da0d05508eba832e64fcbfa0484a
                        )

                )

        )

)

The weird thing is: the original file is located at /background.jpg with 185696 bytes, but the failed file located at /var/www/html/apps/theming/background/background.jpg has 145524 bytes and is not even readable by a photo viewer. So i'm not sure whats happening here.

Note: I'm running Nextcloud in Kubernetes, installed with the official helm chart.

Steps to reproduce

  1. su -p www-data -s /bin/sh -c "php occ theming:config background /background.jpg"
  2. Check /settings/integrity/failed

Expected behavior

The integrity check should not fail.

Installation method

Community Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

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

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "appstoreenabled": true,
        "overwriteprotocol": "https",
        "log_type": "errorlog",
        "loglevel": 0,
        "objectstore": {
            "class": "\\OC\\Files\\ObjectStore\\S3",
            "arguments": {
                "bucket": "Redacted",
                "autocreate": false,
                "region": "eu-central-1",
                "use_ssl": true
            }
        },
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtpsecure": "",
        "mail_smtpauth": false,
        "mail_smtpauthtype": "PLAIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "Redacted"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "25.0.3.2",
        "overwrite.cli.url": "https:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "allow_local_remote_servers": true,
        "allow_user_to_change_display_name": false,
        "lost_password_link": "disabled",
        "oidc_login_provider_url": "Redacted",
        "oidc_login_client_id": "nextcloud",
        "oidc_login_client_secret": "Redacted",
        "oidc_login_auto_redirect": false,
        "oidc_login_logout_url": "Redacted",
        "oidc_login_end_session_redirect": true,
        "oidc_login_default_quota": "1000000000",
        "oidc_login_button_text": "Redacted",
        "oidc_login_hide_password_form": false,
        "oidc_login_use_id_token": false,
        "oidc_login_attributes": {
            "id": "ldapID",
            "name": "name",
            "mail": "email",
            "quota": "ownCloudQuota",
            "home": "homeDirectory",
            "ldap_uid": "uid",
            "groups": "groups",
            "photoURL": "picture",
            "is_admin": "ownCloudAdmin"
        },
        "oidc_login_default_group": "oidc",
        "oidc_login_use_external_storage": false,
        "oidc_login_scope": "openid profile email groups",
        "oidc_login_proxy_ldap": false,
        "oidc_login_disable_registration": false,
        "oidc_login_redir_fallback": false,
        "oidc_login_tls_verify": true,
        "oidc_create_groups": true,
        "oidc_login_webdav_enabled": false,
        "oidc_login_password_authentication": false,
        "oidc_login_public_key_caching_time": 86400,
        "oidc_login_min_time_between_jwks_requests": 10,
        "oidc_login_well_known_caching_time": 86400,
        "oidc_login_update_avatar": false,
        "auth.webauthn.enabled": false,
        "hide_login_form": false,
        "theme": "",
        "default_phone_region": "de"
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - photos: 2.0.1
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.3
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - updatenotification: 1.15.0
  - user_oidc: 1.2.1
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - admin_audit
  - bruteforcesettings
  - encryption
  - files_external
  - suspicious_login
  - twofactor_totp
  - user_ldap: 1.11.0

Nextcloud Signing status

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- theming
    - EXTRA_FILE
        - background/background.jpg

Raw output
==========
Array
(
    [theming] => Array
        (
            [EXTRA_FILE] => Array
                (
                    [background/background.jpg] => Array
                        (
                            [expected] => 
                            [current] => 478f1342d1f9940b722668306a6150d01ddbe5562c28b6045b378882895c139a36817eab2dadb6b2ee5c4501970df5c131f2da0d05508eba832e64fcbfa0484a
                        )

                )

        )

)

Nextcloud Logs

Nothing relevant to that issue, but i'm seeing a lot of `"Exception":"Error","Message":"Array to string conversion at /var/www/html/lib/private/Log/Errorlog.php#46"`, which is a fixed bug (#35614) but not yet released for version 25.

Additional info

No response

joshtrichards commented 3 weeks ago

The weird thing is: the original file is located at /background.jpg with 185696 bytes, but the failed file located at /var/www/html/apps/theming/background/background.jpg has 145524 bytes and is not even readable by a photo viewer. So i'm not sure whats happening here.

We store custom backgrounds in data/appdata no there so not sure how yours ended up there.

I can't reproduce this. If you remove the mysterious file then re-run your reproduction steps, does the file re-appear there?

Also, do you have a background file located in <datadirectory/appdata_<instanceId>/theming/global/?