nextcloud / calendar

📆 Calendar app for Nextcloud
https://apps.nextcloud.com/apps/calendar
GNU Affero General Public License v3.0
981 stars 241 forks source link

[Bug]: Exception when sharing files to user without login in `CalendarInitialStateService.php` / `AppointmentConfigService.php` #6114

Closed MelBourbon closed 4 months ago

MelBourbon commented 4 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

When a user wants to open a shared link a internal server error will be received. The log throws the following:

Exception
OCA\Calendar\Service\Appointments\AppointmentConfigService::getAllAppointmentConfigurations(): Argument nextcloud/server#1 ($userId) must be of type string, null given, called in /var/www/nextcloud/apps/calendar/lib/Service/CalendarInitialStateService.php on line 96 in file '/var/www/nextcloud/apps/calendar/lib/Service/Appointments/AppointmentConfigService.php' line 62

Issue occured after update to Nextcloud Hub 8 (29.0.3)

Steps to reproduce

  1. Share a file or folder and send the link to other user
  2. User opens the link

Expected behavior

The user should be able to see the shared files

Installation method

Community Manual installation with Archive

Nextcloud Server version

29

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

PostgreSQL

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

Upgraded to a MAJOR version (ex. 28 to 29)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "blacklisted_files": [
            ".htaccess",
            "Thumbs.db",
            "thumbs.db"
        ],
        "trusted_domains": [
            "server.roeslr.com",
            "37.120.167.237"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "share_folder": "\/Mit mir geteilt",
        "overwrite.cli.url": "https:\/\/server.roeslr.com",
        "dbtype": "pgsql",
        "version": "29.0.3.4",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "5432",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "default_phone_region": "DE",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\Movie",
            "OC\\Preview\\PDF",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "preview_max_scale_factor": 1,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "overwriteprotocol": "https",
        "logtimezone": "Europe\/Berlin",
        "auth.bruteforce.protection.enabled": true,
        "maintenance": false,
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpsecure": "ssl",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "loglevel": 2,
        "updater.release.channel": "stable",
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": {
            "overwriteprotocol": "https",
            "0": "Bots"
        },
        "mail_sendmailmode": "smtp",
        "mysql.utf8mb4": true,
        "app_install_overwrite": [
            "calendar",
            "files_texteditor"
        ],
        "ldapIgnoreNamingRules": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0.5,
            "dbindex": 1
        },
        "encryption.legacy_format_support": false,
        "maintenance_window_start": 1
    }
}

List of activated Apps

Enabled:
  - activity: 2.21.1
  - admin_audit: 1.19.0
  - bruteforcesettings: 2.9.0
  - calendar: 4.7.9
  - circles: 29.0.0-dev
  - cloud_federation_api: 1.12.0
  - comments: 1.19.0
  - contacts: 6.0.0
  - contactsinteraction: 1.10.0
  - dashboard: 7.9.0
  - dav: 1.30.1
  - encryption: 2.17.0
  - federatedfilesharing: 1.19.0
  - federation: 1.19.0
  - files: 2.1.0
  - files_downloadlimit: 2.0.0
  - files_external: 1.21.0
  - files_pdfviewer: 2.10.0
  - files_reminders: 1.2.0
  - files_sharing: 1.21.0
  - files_texteditor: 2.15.1
  - files_trashbin: 1.19.0
  - files_versions: 1.22.0
  - firstrunwizard: 2.18.0
  - forms: 4.2.4
  - logreader: 2.14.0
  - lookup_server_connector: 1.17.0
  - nextcloud_announcements: 1.18.0
  - notes: 4.10.0
  - notifications: 2.17.0
  - oauth2: 1.17.0
  - password_policy: 1.19.0
  - photos: 2.5.0
  - previewgenerator: 5.5.0
  - privacy: 1.13.0
  - provisioning_api: 1.19.0
  - recommendations: 2.1.0
  - related_resources: 1.4.0
  - richdocuments: 8.4.3
  - richdocumentscode: 24.4.402
  - serverinfo: 1.19.0
  - settings: 1.12.0
  - sharebymail: 1.19.0
  - snappymail: 2.36.4
  - support: 1.12.0
  - survey_client: 1.17.0
  - suspicious_login: 7.0.0
  - systemtags: 1.19.0
  - tasks: 0.16.0
  - text: 3.10.1
  - theming: 2.4.0
  - theming_customcss: 1.16.0
  - twofactor_backupcodes: 1.18.0
  - updatenotification: 1.19.1
  - user_status: 1.9.0
  - viewer: 2.3.0
  - weather_status: 1.9.0
  - workflowengine: 2.11.0
Disabled:
  - twofactor_totp: 11.0.0-dev (installed 11.0.0-dev)
  - user_ldap: 1.20.0 (installed 1.20.0)

Nextcloud Signing status

No response

Nextcloud Logs

Exception
OCA\Calendar\Service\Appointments\AppointmentConfigService::getAllAppointmentConfigurations(): Argument nextcloud/server#1 ($userId) must be of type string, null given, called in /var/www/nextcloud/apps/calendar/lib/Service/CalendarInitialStateService.php on line 96 in file '/var/www/nextcloud/apps/calendar/lib/Service/Appointments/AppointmentConfigService.php' line 62

Additional info

No response

joshtrichards commented 4 months ago

Issue occured after update to v29.0.3

Probably more related to Calendar v4.7.9 I'm guessing since that's some new code from only a few hours ago it looks like. :)

Happen to have the entire log entry containing the full stack trace?

rutgerputter commented 4 months ago

I'm impacted as well. Here is the entire log line when a unauthenticated use accesses a shred link:

{"reqId":"vwU0jjcQSyPXwaSyK0TU","level":3,"time":"2024-07-04T06:53:34+00:00","remoteAddr":"*******","user":"--","app":"index","method":"GET","url":"/s/f79Z8tnTFCYAQpx","message":"OCA\\Calendar\\Service\\Appointments\\AppointmentConfigService::getAllAppointmentConfigurations(): Argument #1 ($userId) must be of type string, null given, called in /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php on line 96 in file '/var/www/html/custom_apps/calendar/lib/Service/Appointments/AppointmentConfigService.php' line 62","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","version":"29.0.3.4","exception":{"Exception":"Exception","Message":"OCA\\Calendar\\Service\\Appointments\\AppointmentConfigService::getAllAppointmentConfigurations(): Argument #1 ($userId) must be of type string, null given, called in /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php on line 96 in file '/var/www/html/custom_apps/calendar/lib/Service/Appointments/AppointmentConfigService.php' line 62","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Files_Sharing\\Controller\\ShareController"],"showShare"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\ShareController","showShare",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["f79Z8tnTFCYAQpx","files_sharing.share.showshare"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/s/f79Z8tnTFCYAQpx"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":170,"Previous":{"Exception":"TypeError","Message":"OCA\\Calendar\\Service\\Appointments\\AppointmentConfigService::getAllAppointmentConfigurations(): Argument #1 ($userId) must be of type string, null given, called in /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php on line 96","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php","line":96,"function":"getAllAppointmentConfigurations","class":"OCA\\Calendar\\Service\\Appointments\\AppointmentConfigService","type":"->","args":[null]},{"file":"/var/www/html/custom_apps/calendar/lib/Listener/CalendarReferenceListener.php","line":48,"function":"run","class":"OCA\\Calendar\\Service\\CalendarInitialStateService","type":"->","args":[]},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Calendar\\Listener\\CalendarReferenceListener","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"],["Closure"],["Closure"],["Closure"],["Closure"],"And 8 more entries, set log level to debug to see all entries"],"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/text/lib/Listeners/LoadEditorListener.php","line":50,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Text\\Listeners\\LoadEditorListener","type":"->","args":[["OCA\\Text\\Event\\LoadEditor"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCA\\Text\\Event\\LoadEditor"],"OCA\\Text\\Event\\LoadEditor","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"]],"OCA\\Text\\Event\\LoadEditor",["OCA\\Text\\Event\\LoadEditor"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Text\\Event\\LoadEditor"],"OCA\\Text\\Event\\LoadEditor"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCA\\Text\\Event\\LoadEditor",["OCA\\Text\\Event\\LoadEditor"]]},{"file":"/var/www/html/custom_apps/deck/lib/AppInfo/Application.php","line":104,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Text\\Event\\LoadEditor"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"OCA\\Deck\\AppInfo\\{closure}","class":"OCA\\Deck\\AppInfo\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"],["Closure"],["Closure"],["Closure"],["Closure"],"And 8 more entries, set log level to debug to see all entries"],"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/text/lib/Listeners/LoadViewerListener.php","line":52,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Text\\Listeners\\LoadViewerListener","type":"->","args":[["OCA\\Viewer\\Event\\LoadViewer"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCA\\Viewer\\Event\\LoadViewer"],"OCA\\Viewer\\Event\\LoadViewer","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"],["Closure"],["Closure"],["Closure"],["Closure"]],"OCA\\Viewer\\Event\\LoadViewer",["OCA\\Viewer\\Event\\LoadViewer"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Viewer\\Event\\LoadViewer"],"OCA\\Viewer\\Event\\LoadViewer"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCA\\Viewer\\Event\\LoadViewer",["OCA\\Viewer\\Event\\LoadViewer"]]},{"file":"/var/www/html/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php","line":237,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Viewer\\Event\\LoadViewer"]]},{"file":"/var/www/html/apps/files_sharing/lib/Controller/ShareController.php","line":346,"function":"renderPage","class":"OCA\\Files_Sharing\\DefaultPublicShareTemplateProvider","type":"->","args":[["OC\\Share20\\Share"],"f79Z8tnTFCYAQpx",""]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"showShare","class":"OCA\\Files_Sharing\\Controller\\ShareController","type":"->","args":[""]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Files_Sharing\\Controller\\ShareController"],"showShare"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Files_Sharing\\Controller\\ShareController"],"showShare"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\ShareController","showShare",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["f79Z8tnTFCYAQpx","files_sharing.share.showshare"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/s/f79Z8tnTFCYAQpx"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/calendar/lib/Service/Appointments/AppointmentConfigService.php","Line":62},"message":"OCA\\Calendar\\Service\\Appointments\\AppointmentConfigService::getAllAppointmentConfigurations(): Argument #1 ($userId) must be of type string, null given, called in /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php on line 96 in file '/var/www/html/custom_apps/calendar/lib/Service/Appointments/AppointmentConfigService.php' line 62","exception":{},"CustomMessage":"OCA\\Calendar\\Service\\Appointments\\AppointmentConfigService::getAllAppointmentConfigurations(): Argument #1 ($userId) must be of type string, null given, called in /var/www/html/custom_apps/calendar/lib/Service/CalendarInitialStateService.php on line 96 in file '/var/www/html/custom_apps/calendar/lib/Service/Appointments/AppointmentConfigService.php' line 62"}}

rutgerputter commented 4 months ago

Guest access to Talk rooms is impacted as well. Disabling the Calendar app seems to work.

Let's hope the fix from #6113 and #6115 is coming soon because we can't live without either feature for very long.

rutgerputter commented 4 months ago

/relate #6113 #6115

rutgerputter commented 4 months ago

Hot patching the CalendarInitialStateService.php on line 96 from #6615 works and unauthenticated users can reach the shared folders and Talk rooms again.

hamza221 commented 4 months ago

Fixed in #6115