nextcloud / nextcloud/user_saml

Invalid SP metadata: invalid_xml after upgrading from nextcloud 28.09 to 29.08

Open
#902 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
PHP
Stars
104
Forks
85
Avg merge
1d 15h
Merged PRs (30d)
16

Description

After upgrade nextcloud, the app stopped working. I started getting invalid redirect URI on keycloak.
After trying to regenerate a new metadata inside the https://mydomain/index.php/settings/admin/saml I get internal server error.
The logs show:

{
  "reqId": "eV7qITLbbustQPj6TXFc",
  "level": 3,
  "time": "2024-11-05T21:48:48+00:00",
  "remoteAddr": "192.168.254.129",
  "user": "myuser",
  "app": "index",
  "method": "GET",
  "url": "/index.php/apps/user_saml/saml/metadata?idp=1",
  "message": "Invalid SP metadata: invalid_xml",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0",
  "version": "29.0.8.1",
  "exception": {
    "Exception": "OneLogin\\Saml2\\Error",
    "Message": "Invalid SP metadata: invalid_xml",
    "Code": 3,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 232,
        "function": "getMetadata",
        "class": "OCA\\User_SAML\\Controller\\SAMLController",
        "type": "->",
        "args": [
          1
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 138,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\User_SAML\\Controller\\SAMLController"
          ],
          "getMetadata"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\User_SAML\\Controller\\SAMLController"
          ],
          "getMetadata"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 331,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\User_SAML\\Controller\\SAMLController",
          "getMetadata",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "user_saml.saml.getmetadata"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1058,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/user_saml/saml/metadata"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 49,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/custom_apps/user_saml/lib/Controller/SAMLController.php",
    "Line": 285,
    "message": "Invalid SP metadata: invalid_xml",
    "exception": {},
    "CustomMessage": "Invalid SP metadata: invalid_xml"
  }
}

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 custom_apps/user_saml/lib/Controller/SAMLController.php line 285 and reproduce the /apps/user_saml/saml/metadata endpoint after the reported upgrade. Inspect the generated service-provider metadata and the logged invalid_xml exception to determine why the response is rejected. Done means the endpoint returns valid SAML metadata without an internal server error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.