nextcloud / nextcloud/user_saml
length of "uid" column for SAML authentication is too short (table oc_user_saml_users)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 104
- Forks
- 85
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 16
Description
Steps to reproduce
1.Connect SSO/SAML app to an Identity Provider that issues the eduGAIN-wide standard eduPersonUniqueID as User ID
2. associate this epUID (name="urn:oid:1.3.6.1.4.1.5923.1.1.1.13") to the UserID in the SAML app's preferences
3. Login with that IdP
Expected behaviour
Login succeeding
Actual behaviour
Login failing; The epUID f7980c823d8168f9a9e750ec8f2239a87eff717759d1cb811c7c61d7420462a9@dariah.eu (fixed-length 64byte Hash + '@' + variable-length institution's scope) is not being accepted:
Error | index | Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'INSERT INTO `oc_user_saml_users` (`uid`) VALUES(?)' with params ["f7980c823d8168f9a9e750ec8f2239a87eff717759d1cb811c7c61d7420462a9@dariah.eu"]: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'uid' at row 1/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 128: Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException("An exceptio ... 1", Doctrine\DBA ... ]})/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1015: Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Doctrine\DBA ... {}, Doctrine\DBA ... ]}, "INSERT INTO ... )", { 1: "f7980c ... "})/var/www/nextcloud/lib/private/DB/Connection.php - line 216: Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... )", [ "f7980c823 ... "], [ 2])/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 208: OC\DB\Connection->executeUpdate("INSERT INTO ... )", { dcValue1: ... "}, { dcValue1: 2})/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 214: Doctrine\DBAL\Query\QueryBuilder->execute()/var/www/nextcloud/apps/user_saml/lib/UserBackend.php - line 124: OC\DB\QueryBuilder\QueryBuilder->execute()/var/www/nextcloud/apps/user_saml/lib/Controller/SAMLController.php - line 142: OCA\User_SAML\UserBackend->createUserIfNotExists("f7980c823d8 ... u")/var/www/nextcloud/apps/user_saml/lib/Controller/SAMLController.php - line 256: OCA\User_SAML\Controller\SAMLController->autoprovisionIfPossible({ urn:oid:1. ... ]})/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 166: OCA\User_SAML\Controller\SAMLController->assertionConsumerService()/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99: OC\AppFramework\Http\Dispatcher->executeController(OCA\User_SAM ... {}, "assertionConsumerService")/var/www/nextcloud/lib/private/AppFramework/App.php - line 118: OC\AppFramework\Http\Dispatcher->dispatch(OCA\User_SAM ... {}, "assertionConsumerService")/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App::main("OCA\\User_S ... r", "assertionConsumerService", OC\AppFramew ... {}, { _route: "u ... "})OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "u ... "})/var/www/nextcloud/lib/private/Route/Router.php - line 297: call_user_func(OC\AppFramew ... {}, { _route: "u ... "})/var/www/nextcloud/lib/base.php - line 987: OC\Route\Router->match("/apps/user_saml/saml/acs")/var/www/nextcloud/index.php - line 42: OC::handleRequest()Eingefasst vonDoctrine\DBAL\Driver\PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'uid' at row 1/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1006: Doctrine\DBAL\Driver\PDOStatement->execute()/var/www/nextcloud/lib/private/DB/Connection.php - line 216: Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... )", [ "f7980c823 ... "], [ 2])/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 208: OC\DB\Connection->executeUpdate("INSERT INTO ... )", { dcValue1: ... "}, { dcValue1: 2})/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 214: Doctrine\DBAL\Query\QueryBuilder->execute()/var/www/nextcloud/apps/user_saml/lib/UserBackend.php - line 124: OC\DB\QueryBuilder\QueryBuilder->execute()/var/www/nextcloud/apps/user_saml/lib/Controller/SAMLController.php - line 142: OCA\User_SAML\UserBackend->createUserIfNotExists("f7980c823d8 ... u")/var/www/nextcloud/apps/user_saml/lib/Controller/SAMLController.php - line 256: OCA\User_SAML\Controller\SAMLController->autoprovisionIfPossible({ urn:oid:1. ... ]})/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 166: OCA\User_SAML\Controller\SAMLController->assertionConsumerService()/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99: OC\AppFramework\Http\Dispatcher->executeController(OCA\User_SAM ... {}, "assertionConsumerService")/var/www/nextcloud/lib/private/AppFramework/App.php - line 118: OC\AppFramework\Http\Dispatcher->dispatch(OCA\User_SAM ... {}, "assertionConsumerService")/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App::main("OCA\\User_S ... r", "assertionConsumerService", OC\AppFramew ... {}, { _route: "u ... "})OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "u ... "})/var/www/nextcloud/lib/private/Route/Router.php - line 297: call_user_func(OC\AppFramew ... {}, { _route: "u ... "})/var/www/nextcloud/lib/base.php - line 987: OC\Route\Router->match("/apps/user_saml/saml/acs")/var/www/nextcloud/index.php - line 42: OC::handleRequest()Eingefasst vonPDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'uid' at row 1/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php - line 105: PDOStatement->execute(null)/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1006: Doctrine\DBAL\Driver\PDOStatement->execute()/var/www/nextcloud/lib/private/DB/Connection.php - line 216: Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... )", [ "f7980c823 ... "], [ 2])/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 208: OC\DB\Connection->executeUpdate("INSERT INTO ... )", { dcValue1: ... "}, { dcValue1: 2})/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 214: Doctrine\DBAL\Query\QueryBuilder->execute()/var/www/nextcloud/apps/user_saml/lib/UserBackend.php - line 124: OC\DB\QueryBuilder\QueryBuilder->execute()/var/www/nextcloud/apps/user_saml/lib/Controller/SAMLController.php - line 142: OCA\User_SAML\UserBackend->createUserIfNotExists("f7980c823d8 ... u")/var/www/nextcloud/apps/user_saml/lib/Controller/SAMLController.php - line 256: OCA\User_SAML\Controller\SAMLController->autoprovisionIfPossible({ urn:oid:1. ... ]})/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 166: OCA\User_SAML\Controller\SAMLController->assertionConsumerService()/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99: OC\AppFramework\Http\Dispatcher->executeController(OCA\User_SAM ... {}, "assertionConsumerService")/var/www/nextcloud/lib/private/AppFramework/App.php - line 118: OC\AppFramework\Http\Dispatcher->dispatch(OCA\User_SAM ... {}, "assertionConsumerService")/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App::main("OCA\\User_S ... r", "assertionConsumerService", OC\AppFramew ... {}, { _route: "u ... "})OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "u ... "})/var/www/nextcloud/lib/private/Route/Router.php - line 297: call_user_func(OC\AppFramew ... {}, { _route: "u ... "})/var/www/nextcloud/lib/base.php - line 987: OC\Route\Router->match("/apps/user_saml/saml/acs")/var/www/nextcloud/index.php - line 42: OC::handleRequest()
-- | -- | --
Server configuration
Operating system: CENTOS7
Web server: Apache2.4
Database: MariaDB 10.3.10
PHP version: 7.2
Nextcloud version: (see Nextcloud admin page) 14
Updated from an older Nextcloud/ownCloud or fresh install: fresh
Where did you install Nextcloud from: (community edition from official website as ZIP file)
Signing status:
No errors have been found.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in apps/user_saml/lib/UserBackend.php around line 124 and apps/user_saml/lib/Controller/SAMLController.php around line 142, where the failing insert and user creation are shown. Check how the oc_user_saml_users uid column is defined and migrated. Done means the provided eduPersonUniqueID value can be stored and SAML login succeeds without the truncation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, php
- Domain
- authentication, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100