Closed Ma27 closed 1 year ago
Similar issue here after 26 update, but, disable password policy didn't helped (at least not after system tries to issue a new token)
{ "reqId": "0SULpBApVKuVFcILtgcL", "level": 3, "time": "2023-03-23T07:50:15+00:00", "remoteAddr": "10.11.0.101", "user": "*** censored ***", "app": "no app in context", "method": "GET", "url": "/apps/theming/image/background?v=4", "message": "App user_saml threw an error during app.php load: sha1(): Argument #1 ($string) must be of type string, null given", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.1661.44", "version": "26.0.0.11", "exception": { "Exception": "TypeError", "Message": "sha1(): Argument #1 ($string) must be of type string, null given", "Code": 0, "Trace": [ { "file": "/var/www/*** censored ***/lib/private/Authentication/Token/PublicKeyTokenProvider.php", "line": 116, "function": "sha1" }, { "file": "/var/www/*** censored ***/lib/private/Authentication/Token/Manager.php", "line": 69, "function": "generateToken", "class": "OC\\Authentication\\Token\\PublicKeyTokenProvider", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/var/www/*** censored ***/lib/private/User/Session.php", "line": 686, "function": "generateToken", "class": "OC\\Authentication\\Token\\Manager", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/var/www/*** censored ***/lib/private/legacy/OC_User.php", "line": 194, "function": "createSessionToken", "class": "OC\\User\\Session", "type": "->", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/var/www/*** censored ***/lib/private/legacy/OC_User.php", "line": 243, "function": "loginWithApache", "class": "OC_User", "type": "::", "args": [ "*** sensitive parameters replaced ***" ] }, { "file": "/var/www/*** censored ***/apps/user_saml/appinfo/app.php", "line": 88, "function": "handleApacheAuth", "class": "OC_User", "type": "::" }, { "file": "/var/www/*** censored ***/lib/private/legacy/OC_App.php", "line": 316, "args": [ "/var/www/*** censored ***/apps/user_saml/appinfo/app.php" ], "function": "require_once" }, { "file": "/var/www/*** censored ***/lib/private/legacy/OC_App.php", "line": 192, "function": "requireAppFile", "class": "OC_App", "type": "::" }, { "file": "/var/www/*** censored ***/lib/private/legacy/OC_App.php", "line": 141, "function": "loadApp", "class": "OC_App", "type": "::" }, { "file": "/var/www/*** censored ***/lib/base.php", "line": 1028, "function": "loadApps", "class": "OC_App", "type": "::" }, { "file": "/var/www/*** censored ***/index.php", "line": 36, "function": "handleRequest", "class": "OC", "type": "::" } ], "File": "/var/www/*** censored ***/lib/private/Authentication/Token/PublicKeyTokenProvider.php", "Line": 116, "message": "App user_saml threw an error during app.php load: sha1(): Argument #1 ($string) must be of type string, null given", "CustomMessage": "App user_saml threw an error during app.php load: sha1(): Argument #1 ($string) must be of type string, null given" } }
As an interims, I implemented \OCP\Authentication\IProvideUserSecretBackend into UserBackend
Same problem in docker
I had the same problem. I'm using authentication via Azure AD. Disabling the Password policy app helped to temporary solve the problem.
Same here with Nextcloud 26.
I'm using an IdP built with SimpleSAMLphp. I don't have Password policy app enabled, but I encounter the same error.
Here's my backtrace.
#0 /home/x/public_html/cloud.example.net/lib/private/Authentication/Token/PublicKeyTokenProvider.php(116): sha1(NULL)
#1 /home/x/public_html/cloud.example.net/lib/private/Authentication/Token/Manager.php(69): OC\Authentication\Token\PublicKeyTokenProvider->generateToken('d5a0ab987fe4e17...', 'username', 'username', NULL, 'Mozilla/5.0 (Ma...', 0, 0)
#2 /home/x/public_html/cloud.example.net/lib/private/User/Session.php(686): OC\Authentication\Token\Manager->generateToken('d5a0ab987fe4e17...', 'username', 'username', NULL, 'Mozilla/5.0 (Ma...', 0, 0)
#3 /home/x/public_html/cloud.example.net/lib/private/legacy/OC_User.php(194): OC\User\Session->createSessionToken(Object(OC\AppFramework\Http\Request), 'username', 'username', NULL)
#4 /home/x/public_html/cloud.example.net/lib/private/legacy/OC_User.php(243): OC_User::loginWithApache(Object(OCA\User_SAML\UserBackend))
#5 /home/x/public_html/cloud.example.net/lib/base.php(1122): OC_User::handleApacheAuth()
#6 /home/x/public_html/cloud.example.net/lib/base.php(1044): OC::handleLogin(Object(OC\AppFramework\Http\Request))
#7 /home/x/public_html/cloud.example.net/index.php(36): OC::handleRequest()
#8 {main}
I found a solution in the commit(6881d2f) of PublicKeyTokenProvider.php
I just replaced line 116 on PublicKeyTokenProvider.php to
$oldTokenMatches = $randomOldToken && $randomOldToken->getPasswordHash() && $password !== null && $this->hasher->verify(sha1($password) . $password, $randomOldToken->getPasswordHash());
And it worked fine.
I found a solution in the commit(6881d2f) of PublicKeyTokenProvider.php
I just replaced line 116 on PublicKeyTokenProvider.php to
$oldTokenMatches = $randomOldToken && $randomOldToken->getPasswordHash() && $password !== null && $this->hasher->verify(sha1($password) . $password, $randomOldToken->getPasswordHash());
And it worked fine.
This fix still needs the password policy app to be disabled.
thanks above workaround work for me
Same here, reverting https://github.com/nextcloud/server/commit/6881d2f2f15976514cc52d6ea49ff09c5bb81d2b and disabling the password policy app fixed it
Using jumpcloud for SAML, same issue, Internal server error after upgrade to 26, disabling the password policy app has so far been sufficient to get it working again for me.
The workaround of disabling Password policy has stopped working for me now. Is anyone working on this? I need to know whether I need to disable SAML, or do a full restore from backup, or if a fix will be available soon.
The fix in PublicKeyTokenProvider has landed in the main repo already but it hasn't been released as far as I can tell, therefore you need to manually perform that change as well, should not be needed anymore when 26.0.1 drops.
I decided to try modifying the line in PublicKeyTokenProvider.php
and it seems to be working for me (Password Policy still disabled).
Same for me. The workaround to disable the app stopped working this morning. I implemented the fix in the file and it seems to be working now.
Yep, the issue started for me this week aswell, after automatically updating to the latest nextcloud container. Unable to log in via SAML at all... Always error 500.
Also had to manually go in the docker container and disable the password_policy app like so:
docker exec -it -u www-data nextcloud /bin/bash
php occ app:disable password_policy
Now I am instantly able to log in again.... But this is only a temporary workaround for me... please release fix soon🙏
Steps to reproduce
Expected behaviour
Authentication should work.
Actual behaviour
I get an error 500. And the following error in the phpfpm log:
The issue can be solved by deactivating the password policy app. Given Nextcloud doesn't have to deal with passwords here because of SAML it should probably made sure that the app is not touched at all by this.
Server configuration
Operating system: NixOS 22.11
Web server: nginx 1.22
Database: postgresql 15
PHP version: 8.1.16
Nextcloud version: 26.0.0
Where did you install Nextcloud from: NixOS
List of activated apps:
Nextcloud configuration:
Client configuration
irrelevant, server issue
Logs
Nextcloud log (data/owncloud.log)
see above
Browser log
n/a