nextcloud / nextcloud/server

Unable to use webauthn to log in (since Nextcloud 23?)

Open
#30,549 11 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 25-feedback bug feature: authentication needs review
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.
Steps to reproduce

Use the "Log in with a device" feature to log in. After entering a username, and confirming login by pressing the security key's button, nothing happens and the error below is logged to the nextcloud log file:

Error: OC\Core\Controller\WebAuthnController::finishAuthentication(): Argument #1 ($data) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 217 in file '/var/www/html/core/Controller/WebAuthnController.php' line 95
Full raw backtrace
{
  "reqId": "N6q5uRPmPfYYHYmNrYzw",
  "level": 3,
  "time": "2022-01-08T11:00:08+00:00",
  "remoteAddr": "10.0.1.254",
  "user": "--",
  "app": "index",
  "method": "POST",
  "url": "/login/webauthn/finish",
  "message": "OC\\Core\\Controller\\WebAuthnController::finishAuthentication(): Argument #1 ($data) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 217 in file '/var/www/html/core/Controller/WebAuthnController.php' line 95",
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0",
  "version": "23.0.0.10",
  "exception": {
    "Exception": "Exception",
    "Message": "OC\\Core\\Controller\\WebAuthnController::finishAuthentication(): Argument #1 ($data) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 217 in file '/var/www/html/core/Controller/WebAuthnController.php' line 95",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/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/html/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/html/lib/base.php",
        "line": 1006,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": ["/login/webauthn/finish"]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 158,
    "Previous": {
      "Exception": "TypeError",
      "Message": "OC\\Core\\Controller\\WebAuthnController::finishAuthentication(): Argument #1 ($data) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 217",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 217,
          "function": "finishAuthentication",
          "class": "OC\\Core\\Controller\\WebAuthnController",
          "type": "->",
          "args": [null]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 126,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            { "__class__": "OC\\Core\\Controller\\WebAuthnController" },
            "finishAuthentication"
          ]
        },
        {
          "file": "/var/www/html/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/html/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/html/lib/base.php",
          "line": 1006,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": ["/login/webauthn/finish"]
        },
        {
          "file": "/var/www/html/index.php",
          "line": 36,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/var/www/html/core/Controller/WebAuthnController.php",
      "Line": 95
    },
    "CustomMessage": "--"
  },
  "id": "61d97135160fd"
}

Server configuration

Operating system: debian

Web server: nginx

Database: mariadb

PHP version: 8.something

Nextcloud version: 23.0.0

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

Are you using encryption: no

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

Client configuration

Browser: Firefox 95

Operating system: Kubuntu 21.10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at core/Controller/WebAuthnController.php line 95 and trace the /login/webauthn/finish request that calls finishAuthentication with null data. Reproduce the device-login flow using the reported Firefox and Nextcloud versions, then verify that WebAuthn authentication completes without the TypeError and the user is logged in.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.