marius-wieschollek / passwords

A simple, yet feature rich password manager for Nextcloud
GNU Affero General Public License v3.0
208 stars 42 forks source link

[BUG]: Internal Server Error, getUID() on null, in app or personal info page #608

Closed fcharlaix-opendsi closed 11 months ago

fcharlaix-opendsi commented 11 months ago

⚠️ This issue respects the following points: ⚠️

Server Information

{
    "version": {
        "server": "27.1.1.0",
        "app": "2023.9.30",
        "lsr": false,
        "php": "8.2.7",
        "cronPhp": "8.2.7"
    },
    "environment": {
        "os": "Linux",
        "architecture": "x86_64",
        "bits": 64,
        "database": "mysql",
        "cron": "cron",
        "proxy": false,
        "sslProxy": false,
        "subdirectory": false
    },
    "services": {
        "images": "imagick",
        "favicons": "bi",
        "previews": "pageres",
        "security": "hibp",
        "words": "auto",
        "previewApi": false,
        "faviconApi": false
    },
    "status": {
        "autoBackupRestored": false
    },
    "settings": {
        "channel": "stable",
        "nightlies": false,
        "handbook": false,
        "performance": 5
    },
    "encryption": {
        "sse": {
            "SSEv1r1": false,
            "SSEv1r2": true,
            "SSEv2r1": false,
            "SSEv3r1": false,
            "none": true,
            "default": "SSEv1r2"
        },
        "cse": {
            "CSEv1r1": true,
            "none": true,
            "default": "none"
        }
    }
}

Client Information

Browser and Version: Firefox 115.2.0 Client OS and Version: Windows 11

Bug description

Opening the app or entering the user personal info page throw an internal Server Error.

Steps to reproduce

  1. Open the app or personal info
  2. Internal Server Error

Expected behavior

Having access to the desire page...

Nextcloud Logs

{
  "reqId": "XQ5u2JPKKkql7WT6FWo7",
  "level": 3,
  "time": "2023-10-10T14:58:48+00:00",
  "remoteAddr": "****SOME IP****",
  "user": "****LDAP UID****",
  "app": "index",
  "method": "GET",
  "url": "/apps/passwords/",
  "message": "Call to a member function getUID() on null",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
  "version": "27.1.1.0",
  "exception": {
    "Exception": "Error",
    "Message": "Call to a member function getUID() on null",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/passwords/lib/Services/EnvironmentService.php",
        "line": 506,
        "function": "getUserInfoFromUserId",
        "class": "OCA\\Passwords\\Services\\EnvironmentService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/passwords/lib/Services/EnvironmentService.php",
        "line": 375,
        "function": "loadUserFromSession",
        "class": "OCA\\Passwords\\Services\\EnvironmentService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/passwords/lib/Services/EnvironmentService.php",
        "line": 359,
        "function": "loadUserInformation",
        "class": "OCA\\Passwords\\Services\\EnvironmentService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/passwords/lib/Services/EnvironmentService.php",
        "line": 185,
        "function": "determineAppMode",
        "class": "OCA\\Passwords\\Services\\EnvironmentService",
        "type": "->"
      },
      {
        "function": "__construct",
        "class": "OCA\\Passwords\\Services\\EnvironmentService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 84,
        "function": "newInstanceArgs",
        "class": "ReflectionClass",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 124,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 142,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 494,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 466,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 97,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "function": "OC\\AppFramework\\Utility\\{closure}",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 84,
        "function": "array_map"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 124,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 142,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 494,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 466,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 97,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "function": "OC\\AppFramework\\Utility\\{closure}",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 84,
        "function": "array_map"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 124,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 142,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 494,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 466,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 97,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "function": "OC\\AppFramework\\Utility\\{closure}",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 84,
        "function": "array_map"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 124,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 142,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 494,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 466,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 97,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "function": "OC\\AppFramework\\Utility\\{closure}",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 84,
        "function": "array_map"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 124,
        "function": "buildClass",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",
        "line": 142,
        "function": "resolve",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 494,
        "function": "query",
        "class": "OC\\AppFramework\\Utility\\SimpleContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php",
        "line": 466,
        "function": "queryNoFallback",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 162,
        "function": "query",
        "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1068,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/passwords/lib/Services/EnvironmentService.php",
    "Line": 579,
    "CustomMessage": "--"
  }
}

Browser Logs

No response

fcharlaix-opendsi commented 11 months ago

After searching in the source code, I found in lib/Services/EnvironmentService.php that the getUserInfoFromUserId function check only for false as a return of $this->userManager->get($loginName).

But the default IUserManager get function can also return null : https://github.com/nextcloud/server/blob/f8f437072ac13a4556dea18219d55f11466497e5/lib/private/User/Manager.php#L155

marius-wieschollek commented 11 months ago

I have published a nightly update to address the issue.

marius-wieschollek commented 11 months ago

This should be fixed with 2023.10.0