nextcloud / server

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

UniqueConstraintViolationException when trying to authenticate via WebAuthn using YubiKey/SoloKey #27721

Closed lynix closed 3 years ago

lynix commented 3 years ago

Steps to reproduce

  1. Register security key via user settings
  2. Logout
  3. Try to login using registered security key

Expected behaviour

Authentication succeeds, view switches from login form to 'files' page.

Actual behaviour

No visible reaction on frontend. A UniqueConstraintViolationException is thrown (see Nextcloud log below).

Server configuration

Operating system: Debian 10 x86_64

Web server: Nginx 1.14.2

Database: MariaDB 10.3.29

PHP version: 7.3.27-1~deb10u1

Nextcloud version: 21.0.2

Updated from an older Nextcloud/ownCloud or fresh install: updated from previous stable

Where did you install Nextcloud from: manual install via tarball

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list ``` Enabled: - accessibility: 1.7.0 - activity: 2.14.3 - calendar: 2.3.0 - cloud_federation_api: 1.4.0 - contacts: 3.5.1 - contactsinteraction: 1.2.0 - dav: 1.17.1 - federatedfilesharing: 1.11.0 - files: 1.16.0 - files_markdown: 2.3.3 - files_pdfviewer: 2.1.0 - files_rightclick: 1.0.0 - files_sharing: 1.13.1 - files_trashbin: 1.11.0 - files_versions: 1.14.0 - files_videoplayer: 1.10.0 - firstrunwizard: 2.10.0 - logreader: 2.6.0 - lookup_server_connector: 1.9.0 - nextcloud_announcements: 1.10.0 - notifications: 2.9.0 - oauth2: 1.9.0 - password_policy: 1.11.0 - photos: 1.3.0 - previewgenerator: 3.1.1 - privacy: 1.5.0 - provisioning_api: 1.11.0 - serverinfo: 1.11.0 - settings: 1.3.0 - sharebymail: 1.11.0 - survey_client: 1.9.0 - text: 3.2.0 - theming: 1.12.0 - twofactor_backupcodes: 1.10.0 - updatenotification: 1.11.0 - viewer: 1.5.0 - workflowengine: 2.3.0 ```

Nextcloud configuration:

Config report ``` { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "nextcloud.example.com" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "21.0.2.1", "overwrite.cli.url": "http:\/\/nextcloud.example.com", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "trashbin_retention_obligation": "auto, 3", "memcache.local": "\\OC\\Memcache\\APCu", "maintenance": false, "theme": "", "defaultapp": "files", "default_phone_region": "DE", "loglevel": 2 } } ```

Are you using external storage, if yes which one: no Are you using encryption: no Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 89.0.2 Operating system: Arch Linux

Logs

Web server error log

Web server error log ``` (no errors logged) ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` { "reqId": "2TYAezgATT1xxFPUcAAj", "level": 3, "time": "2021-06-29T19:28:12+00:00", "remoteAddr": "2a02:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5923", "user": "--", "app": "index", "method": "POST", "url": "/login/webauthn/finish", "message": { "Exception": "Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException", "Message": "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3' for key 'PRIMARY'", "Code": 1062, "Trace": [ { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Connection.php", "line": 1728, "function": "convert", "class": "Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter", "type": "->", "args": [ { "__class__": "Doctrine\\DBAL\\Driver\\PDO\\Exception" }, { "__class__": "Doctrine\\DBAL\\Query" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Connection.php", "line": 1667, "function": "handleDriverException", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ { "__class__": "Doctrine\\DBAL\\Driver\\PDO\\Exception" }, { "__class__": "Doctrine\\DBAL\\Query" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Connection.php", "line": 1146, "function": "convertExceptionDuringQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ { "__class__": "Doctrine\\DBAL\\Driver\\PDO\\Exception" }, "INSERT INTO `oc_webauthn` (`name`, `uid`, `public_key_credential_id`, `data`, `id`) VALUES(?, ?, ?, ?, ?)", [ "yubikey1", "lynix", "kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==", "{\"publicKeyCredentialId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"transports\":[],\"attestationType\":\"none\",\"trustPath\":{\"type\":\"Webauthn\\\\TrustPath\\\\EmptyTrustPath\"},\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialPublicKey\":\"pQECAyYgASFYIMLJQIXCl1qi1j0KK64CTmfD1xoR4RbdJSCmLPaadJY6IlggyePhLZTPgDXbbCHfnNXxRLWG_c0XwWW5CniA8UdPjCg\",\"userHandle\":\"bHluaXg\",\"counter\":2}", 3 ], [ 2, 2, 2, 2, 1 ] ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/DB/Connection.php", "line": 257, "function": "executeStatement", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ "INSERT INTO `oc_webauthn` (`name`, `uid`, `public_key_credential_id`, `data`, `id`) VALUES(?, ?, ?, ?, ?)", [ "yubikey1", "lynix", "kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==", "{\"publicKeyCredentialId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"transports\":[],\"attestationType\":\"none\",\"trustPath\":{\"type\":\"Webauthn\\\\TrustPath\\\\EmptyTrustPath\"},\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialPublicKey\":\"pQECAyYgASFYIMLJQIXCl1qi1j0KK64CTmfD1xoR4RbdJSCmLPaadJY6IlggyePhLZTPgDXbbCHfnNXxRLWG_c0XwWW5CniA8UdPjCg\",\"userHandle\":\"bHluaXg\",\"counter\":2}", 3 ], [ 2, 2, 2, 2, 1 ] ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php", "line": 213, "function": "executeStatement", "class": "OC\\DB\\Connection", "type": "->", "args": [ "INSERT INTO `oc_webauthn` (`name`, `uid`, `public_key_credential_id`, `data`, `id`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5)", { "dcValue1": "yubikey1", "dcValue2": "lynix", "dcValue3": "kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==", "dcValue4": "{\"publicKeyCredentialId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"transports\":[],\"attestationType\":\"none\",\"trustPath\":{\"type\":\"Webauthn\\\\TrustPath\\\\EmptyTrustPath\"},\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialPublicKey\":\"pQECAyYgASFYIMLJQIXCl1qi1j0KK64CTmfD1xoR4RbdJSCmLPaadJY6IlggyePhLZTPgDXbbCHfnNXxRLWG_c0XwWW5CniA8UdPjCg\",\"userHandle\":\"bHluaXg\",\"counter\":2}", "dcValue5": 3 }, { "dcValue1": 2, "dcValue2": 2, "dcValue3": 2, "dcValue4": 2, "dcValue5": 1 } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/DB/QueryBuilder/QueryBuilder.php", "line": 287, "function": "execute", "class": "Doctrine\\DBAL\\Query\\QueryBuilder", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/public/AppFramework/Db/QBMapper.php", "line": 135, "function": "execute", "class": "OC\\DB\\QueryBuilder\\QueryBuilder", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/public/AppFramework/Db/QBMapper.php", "line": 159, "function": "insert", "class": "OCP\\AppFramework\\Db\\QBMapper", "type": "->", "args": [ { "id": 3, "__class__": "OC\\Authentication\\WebAuthn\\Db\\PublicKeyCredentialEntity" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/CredentialRepository.php", "line": 89, "function": "insertOrUpdate", "class": "OCP\\AppFramework\\Db\\QBMapper", "type": "->", "args": [ { "id": 3, "__class__": "OC\\Authentication\\WebAuthn\\Db\\PublicKeyCredentialEntity" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/CredentialRepository.php", "line": 93, "function": "saveAndReturnCredentialSource", "class": "OC\\Authentication\\WebAuthn\\CredentialRepository", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialSource" }, "default" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/web-auth/webauthn-lib/src/AuthenticatorAssertionResponseValidator.php", "line": 206, "function": "saveCredentialSource", "class": "OC\\Authentication\\WebAuthn\\CredentialRepository", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialSource" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/Manager.php", "line": 235, "function": "check", "class": "Webauthn\\AuthenticatorAssertionResponseValidator", "type": "->", "args": [ null, { "__class__": "Webauthn\\AuthenticatorAssertionResponse" }, { "__class__": "Webauthn\\PublicKeyCredentialRequestOptions" }, { "__class__": "GuzzleHttp\\Psr7\\ServerRequest" }, "lynix" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/core/Controller/WebAuthnController.php", "line": 107, "function": "finishAuthentication", "class": "OC\\Authentication\\WebAuthn\\Manager", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialRequestOptions" }, "{\"id\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"rawId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==\",\"response\":{\"authenticatorData\":\"AJe4Y91+6xyGbTlFuu69312RpXcO9bAmertoUS8RaXsBAAAAAg==\",\"clientDataJSON\":\"eyJjaGFsbGVuZ2UiOiI1c2Y3YXV4SFo5YlKqaXsmeUADU0pMWE4senZid2tqbkprV0VMdFNYNUpNIiwiY2xpZW50RXh0ZW5zaW9ucyI6e30sImhhc2hBbGdvcml0aG0iOiJTSEEtMjU2Iiwib3JpZ2luIjoiaHR0cHM6Ly9uYy50dXhlZC5vcmciLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0=\",\"signature\":\"MEQCIH/NQNqTUV7wtom4g/hALqwCh4lq9Bl7Ra6du6/+RTZzAiBYlm5Py1Y9N8NZFnhKEo8xWTVevW9sdkMRiOBhNIl8MA==\",\"userHandle\":null}}", "lynix" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/Http/Dispatcher.php", "line": 218, "function": "finishAuthentication", "class": "OC\\Core\\Controller\\WebAuthnController", "type": "->", "args": [ "{\"id\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"rawId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==\",\"response\":{\"authenticatorData\":\"AJe4Y91+6xyGbTlFuu69312RpXcO9bAmertoUS8RaXsBAAAAAg==\",\"clientDataJSON\":\"eyJjaGFsbGVuZ2UiOiI1c2Y3YXV4SFo5YlKqaXsmeUADU0pMWE4senZid2tqbkprV0VMdFNYNUpNIiwiY2xpZW50RXh0ZW5zaW9ucyI6e30sImhhc2hBbGdvcml0aG0iOiJTSEEtMjU2Iiwib3JpZ2luIjoiaHR0cHM6Ly9uYy50dXhlZC5vcmciLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0=\",\"signature\":\"MEQCIH/NQNqTUV7wtom4g/hALqwCh4lq9Bl7Ra6du6/+RTZzAiBYlm5Py1Y9N8NZFnhKEo8xWTVevW9sdkMRiOBhNIl8MA==\",\"userHandle\":null}}" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/Http/Dispatcher.php", "line": 127, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OC\\Core\\Controller\\WebAuthnController" }, "finishAuthentication" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/App.php", "line": 157, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OC\\Core\\Controller\\WebAuthnController" }, "finishAuthentication" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Route/Router.php", "line": 302, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OC\\Core\\Controller\\WebAuthnController", "finishAuthentication", { "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer" }, { "_route": "core.WebAuthn.finishAuthentication" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/base.php", "line": 993, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "/login/webauthn/finish" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/index.php", "line": 37, "function": "handleRequest", "class": "OC", "type": "::", "args": [] } ], "File": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php", "Line": 60, "Previous": { "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception", "Message": "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3' for key 'PRIMARY'", "Code": 1062, "Trace": [ { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "line": 84, "function": "new", "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception", "type": "::", "args": [ { "errorInfo": [ "23000", 1062, "Duplicate entry '3' for key 'PRIMARY'" ], "__class__": "PDOException" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Connection.php", "line": 1136, "function": "execute", "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/DB/Connection.php", "line": 257, "function": "executeStatement", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ "INSERT INTO `oc_webauthn` (`name`, `uid`, `public_key_credential_id`, `data`, `id`) VALUES(?, ?, ?, ?, ?)", [ "yubikey1", "lynix", "kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==", "{\"publicKeyCredentialId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"transports\":[],\"attestationType\":\"none\",\"trustPath\":{\"type\":\"Webauthn\\\\TrustPath\\\\EmptyTrustPath\"},\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialPublicKey\":\"pQECAyYgASFYIMLJQIXCl1qi1j0KK64CTmfD1xoR4RbdJSCmLPaadJY6IlggyePhLZTPgDXbbCHfnNXxRLWG_c0XwWW5CniA8UdPjCg\",\"userHandle\":\"bHluaXg\",\"counter\":2}", 3 ], [ 2, 2, 2, 2, 1 ] ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php", "line": 213, "function": "executeStatement", "class": "OC\\DB\\Connection", "type": "->", "args": [ "INSERT INTO `oc_webauthn` (`name`, `uid`, `public_key_credential_id`, `data`, `id`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5)", { "dcValue1": "yubikey1", "dcValue2": "lynix", "dcValue3": "kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==", "dcValue4": "{\"publicKeyCredentialId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"transports\":[],\"attestationType\":\"none\",\"trustPath\":{\"type\":\"Webauthn\\\\TrustPath\\\\EmptyTrustPath\"},\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialPublicKey\":\"pQECAyYgASFYIMLJQIXCl1qi1j0KK64CTmfD1xoR4RbdJSCmLPaadJY6IlggyePhLZTPgDXbbCHfnNXxRLWG_c0XwWW5CniA8UdPjCg\",\"userHandle\":\"bHluaXg\",\"counter\":2}", "dcValue5": 3 }, { "dcValue1": 2, "dcValue2": 2, "dcValue3": 2, "dcValue4": 2, "dcValue5": 1 } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/DB/QueryBuilder/QueryBuilder.php", "line": 287, "function": "execute", "class": "Doctrine\\DBAL\\Query\\QueryBuilder", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/public/AppFramework/Db/QBMapper.php", "line": 135, "function": "execute", "class": "OC\\DB\\QueryBuilder\\QueryBuilder", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/public/AppFramework/Db/QBMapper.php", "line": 159, "function": "insert", "class": "OCP\\AppFramework\\Db\\QBMapper", "type": "->", "args": [ { "id": 3, "__class__": "OC\\Authentication\\WebAuthn\\Db\\PublicKeyCredentialEntity" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/CredentialRepository.php", "line": 89, "function": "insertOrUpdate", "class": "OCP\\AppFramework\\Db\\QBMapper", "type": "->", "args": [ { "id": 3, "__class__": "OC\\Authentication\\WebAuthn\\Db\\PublicKeyCredentialEntity" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/CredentialRepository.php", "line": 93, "function": "saveAndReturnCredentialSource", "class": "OC\\Authentication\\WebAuthn\\CredentialRepository", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialSource" }, "default" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/web-auth/webauthn-lib/src/AuthenticatorAssertionResponseValidator.php", "line": 206, "function": "saveCredentialSource", "class": "OC\\Authentication\\WebAuthn\\CredentialRepository", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialSource" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/Manager.php", "line": 235, "function": "check", "class": "Webauthn\\AuthenticatorAssertionResponseValidator", "type": "->", "args": [ null, { "__class__": "Webauthn\\AuthenticatorAssertionResponse" }, { "__class__": "Webauthn\\PublicKeyCredentialRequestOptions" }, { "__class__": "GuzzleHttp\\Psr7\\ServerRequest" }, "lynix" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/core/Controller/WebAuthnController.php", "line": 107, "function": "finishAuthentication", "class": "OC\\Authentication\\WebAuthn\\Manager", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialRequestOptions" }, "{\"id\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"rawId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==\",\"response\":{\"authenticatorData\":\"AJe4Y91+6xyGbTlFuu69312RpXcO9bAmertoUS8RaXsBAAAAAg==\",\"clientDataJSON\":\"eyJjaGFsbGVuZ2UiOiI1c2Y3YXV4SFo5YlKqaXsmeUADU0pMWE4senZid2tqbkprV0VMdFNYNUpNIiwiY2xpZW50RXh0ZW5zaW9ucyI6e30sImhhc2hBbGdvcml0aG0iOiJTSEEtMjU2Iiwib3JpZ2luIjoiaHR0cHM6Ly9uYy50dXhlZC5vcmciLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0=\",\"signature\":\"MEQCIH/NQNqTUV7wtom4g/hALqwCh4lq9Bl7Ra6du6/+RTZzAiBYlm5Py1Y9N8NZFnhKEo8xWTVevW9sdkMRiOBhNIl8MA==\",\"userHandle\":null}}", "lynix" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/Http/Dispatcher.php", "line": 218, "function": "finishAuthentication", "class": "OC\\Core\\Controller\\WebAuthnController", "type": "->", "args": [ "{\"id\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"rawId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==\",\"response\":{\"authenticatorData\":\"AJe4Y91+6xyGbTlFuu69312RpXcO9bAmertoUS8RaXsBAAAAAg==\",\"clientDataJSON\":\"eyJjaGFsbGVuZ2UiOiI1c2Y3YXV4SFo5YlKqaXsmeUADU0pMWE4senZid2tqbkprV0VMdFNYNUpNIiwiY2xpZW50RXh0ZW5zaW9ucyI6e30sImhhc2hBbGdvcml0aG0iOiJTSEEtMjU2Iiwib3JpZ2luIjoiaHR0cHM6Ly9uYy50dXhlZC5vcmciLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0=\",\"signature\":\"MEQCIH/NQNqTUV7wtom4g/hALqwCh4lq9Bl7Ra6du6/+RTZzAiBYlm5Py1Y9N8NZFnhKEo8xWTVevW9sdkMRiOBhNIl8MA==\",\"userHandle\":null}}" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/Http/Dispatcher.php", "line": 127, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OC\\Core\\Controller\\WebAuthnController" }, "finishAuthentication" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/App.php", "line": 157, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OC\\Core\\Controller\\WebAuthnController" }, "finishAuthentication" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Route/Router.php", "line": 302, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OC\\Core\\Controller\\WebAuthnController", "finishAuthentication", { "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer" }, { "_route": "core.WebAuthn.finishAuthentication" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/base.php", "line": 993, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "/login/webauthn/finish" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/index.php", "line": 37, "function": "handleRequest", "class": "OC", "type": "::", "args": [] } ], "File": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php", "Line": 26, "Previous": { "Exception": "PDOException", "Message": "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3' for key 'PRIMARY'", "Code": "23000", "Trace": [ { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "line": 82, "function": "execute", "class": "PDOStatement", "type": "->", "args": [ null ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Connection.php", "line": 1136, "function": "execute", "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/DB/Connection.php", "line": 257, "function": "executeStatement", "class": "Doctrine\\DBAL\\Connection", "type": "->", "args": [ "INSERT INTO `oc_webauthn` (`name`, `uid`, `public_key_credential_id`, `data`, `id`) VALUES(?, ?, ?, ?, ?)", [ "yubikey1", "lynix", "kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==", "{\"publicKeyCredentialId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"transports\":[],\"attestationType\":\"none\",\"trustPath\":{\"type\":\"Webauthn\\\\TrustPath\\\\EmptyTrustPath\"},\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialPublicKey\":\"pQECAyYgASFYIMLJQIXCl1qi1j0KK64CTmfD1xoR4RbdJSCmLPaadJY6IlggyePhLZTPgDXbbCHfnNXxRLWG_c0XwWW5CniA8UdPjCg\",\"userHandle\":\"bHluaXg\",\"counter\":2}", 3 ], [ 2, 2, 2, 2, 1 ] ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php", "line": 213, "function": "executeStatement", "class": "OC\\DB\\Connection", "type": "->", "args": [ "INSERT INTO `oc_webauthn` (`name`, `uid`, `public_key_credential_id`, `data`, `id`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5)", { "dcValue1": "yubikey1", "dcValue2": "lynix", "dcValue3": "kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==", "dcValue4": "{\"publicKeyCredentialId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"transports\":[],\"attestationType\":\"none\",\"trustPath\":{\"type\":\"Webauthn\\\\TrustPath\\\\EmptyTrustPath\"},\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialPublicKey\":\"pQECAyYgASFYIMLJQIXCl1qi1j0KK64CTmfD1xoR4RbdJSCmLPaadJY6IlggyePhLZTPgDXbbCHfnNXxRLWG_c0XwWW5CniA8UdPjCg\",\"userHandle\":\"bHluaXg\",\"counter\":2}", "dcValue5": 3 }, { "dcValue1": 2, "dcValue2": 2, "dcValue3": 2, "dcValue4": 2, "dcValue5": 1 } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/DB/QueryBuilder/QueryBuilder.php", "line": 287, "function": "execute", "class": "Doctrine\\DBAL\\Query\\QueryBuilder", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/public/AppFramework/Db/QBMapper.php", "line": 135, "function": "execute", "class": "OC\\DB\\QueryBuilder\\QueryBuilder", "type": "->", "args": [] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/public/AppFramework/Db/QBMapper.php", "line": 159, "function": "insert", "class": "OCP\\AppFramework\\Db\\QBMapper", "type": "->", "args": [ { "id": 3, "__class__": "OC\\Authentication\\WebAuthn\\Db\\PublicKeyCredentialEntity" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/CredentialRepository.php", "line": 89, "function": "insertOrUpdate", "class": "OCP\\AppFramework\\Db\\QBMapper", "type": "->", "args": [ { "id": 3, "__class__": "OC\\Authentication\\WebAuthn\\Db\\PublicKeyCredentialEntity" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/CredentialRepository.php", "line": 93, "function": "saveAndReturnCredentialSource", "class": "OC\\Authentication\\WebAuthn\\CredentialRepository", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialSource" }, "default" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/3rdparty/web-auth/webauthn-lib/src/AuthenticatorAssertionResponseValidator.php", "line": 206, "function": "saveCredentialSource", "class": "OC\\Authentication\\WebAuthn\\CredentialRepository", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialSource" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Authentication/WebAuthn/Manager.php", "line": 235, "function": "check", "class": "Webauthn\\AuthenticatorAssertionResponseValidator", "type": "->", "args": [ null, { "__class__": "Webauthn\\AuthenticatorAssertionResponse" }, { "__class__": "Webauthn\\PublicKeyCredentialRequestOptions" }, { "__class__": "GuzzleHttp\\Psr7\\ServerRequest" }, "lynix" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/core/Controller/WebAuthnController.php", "line": 107, "function": "finishAuthentication", "class": "OC\\Authentication\\WebAuthn\\Manager", "type": "->", "args": [ { "__class__": "Webauthn\\PublicKeyCredentialRequestOptions" }, "{\"id\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"rawId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==\",\"response\":{\"authenticatorData\":\"AJe4Y91+6xyGbTlFuu69312RpXcO9bAmertoUS8RaXsBAAAAAg==\",\"clientDataJSON\":\"eyJjaGFsbGVuZ2UiOiI1c2Y3YXV4SFo5YlKqaXsmeUADU0pMWE4senZid2tqbkprV0VMdFNYNUpNIiwiY2xpZW50RXh0ZW5zaW9ucyI6e30sImhhc2hBbGdvcml0aG0iOiJTSEEtMjU2Iiwib3JpZ2luIjoiaHR0cHM6Ly9uYy50dXhlZC5vcmciLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0=\",\"signature\":\"MEQCIH/NQNqTUV7wtom4g/hALqwCh4lq9Bl7Ra6du6/+RTZzAiBYlm5Py1Y9N8NZFnhKEo8xWTVevW9sdkMRiOBhNIl8MA==\",\"userHandle\":null}}", "lynix" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/Http/Dispatcher.php", "line": 218, "function": "finishAuthentication", "class": "OC\\Core\\Controller\\WebAuthnController", "type": "->", "args": [ "{\"id\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq-bi720sAYPNo-yheGdRZf1sj-qj5gCTKXbDEV3cPiRVGfZdN_5zFA\",\"type\":\"public-key\",\"rawId\":\"kAdDAIzOflc1FNpb5kJ411jobOocxHOjq+bi720sAYPNo+yheGdRZf1sj+qj5gCTKXbDEV3cPiRVGfZdN/5zFA==\",\"response\":{\"authenticatorData\":\"AJe4Y91+6xyGbTlFuu69312RpXcO9bAmertoUS8RaXsBAAAAAg==\",\"clientDataJSON\":\"eyJjaGFsbGVuZ2UiOiI1c2Y3YXV4SFo5YlKqaXsmeUADU0pMWE4senZid2tqbkprV0VMdFNYNUpNIiwiY2xpZW50RXh0ZW5zaW9ucyI6e30sImhhc2hBbGdvcml0aG0iOiJTSEEtMjU2Iiwib3JpZ2luIjoiaHR0cHM6Ly9uYy50dXhlZC5vcmciLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0=\",\"signature\":\"MEQCIH/NQNqTUV7wtom4g/hALqwCh4lq9Bl7Ra6du6/+RTZzAiBYlm5Py1Y9N8NZFnhKEo8xWTVevW9sdkMRiOBhNIl8MA==\",\"userHandle\":null}}" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/Http/Dispatcher.php", "line": 127, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OC\\Core\\Controller\\WebAuthnController" }, "finishAuthentication" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/AppFramework/App.php", "line": 157, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OC\\Core\\Controller\\WebAuthnController" }, "finishAuthentication" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/private/Route/Router.php", "line": 302, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OC\\Core\\Controller\\WebAuthnController", "finishAuthentication", { "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer" }, { "_route": "core.WebAuthn.finishAuthentication" } ] }, { "file": "/var/www/nextcloud.example.com/htdocs/lib/base.php", "line": 993, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "/login/webauthn/finish" ] }, { "file": "/var/www/nextcloud.example.com/htdocs/index.php", "line": 37, "function": "handleRequest", "class": "OC", "type": "::", "args": [] } ], "File": "/var/www/nextcloud.example.com/htdocs/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "Line": 82 } }, "CustomMessage": "--" }, "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0", "version": "21.0.2.1" } ```

(sensitive information has been masked/altered)

Browser log

Browser log ``` (no errors logged) ```
ChristophWurst commented 3 years ago

With Nextcloud 22 this should be fixed, as executeStatement is used instead of execute and that one throws the correct exception https://github.com/nextcloud/server/blame/stable22/lib/public/AppFramework/Db/QBMapper.php

szaimen commented 3 years ago

Lets track this in #27662