Skip to content

Latest IDP changes break conformance test harness run #1158

Closed

Description

@jvherweg

Description

As the title says. This is not unexpected, should have seen this coming actually.

There are 2 issues with the current implementations. Both could be fixed in CSS itself.

1. The test harness can't find the HTML POST form

Relevant failed run: https://github.com/solid/community-server/runs/5180518302?check_suite_focus=true#step:9:164
During the login procedure the CTH does a GET to /idp/login/ and tries to find the form. The issue here is that the CTH does not send an Accept header requesting HTML and since the latest changes, we return JSON instead of HTML if there are no preferences. Easiest solution here is to add a line changing the preferences to HTML in case there is no accept header.

Note that it actually is not really necessary for the CTH to find the form, it can just post to the same URL and the JSON we return when doing the GET there is

{
  "required": {
    "email": "string",
    "password": "string",
    "remember": "boolean"
  },
  "controls": {
    "register": "http://localhost:3000/idp/register/",
    "index": "http://localhost:3000/idp/",
    "prompt": "http://localhost:3000/idp/prompt/",
    "login": "http://localhost:3000/idp/login/",
    "forgotPassword": "http://localhost:3000/idp/forgotpassword/"
  },
  "apiVersion": "0.3"
}

But perhaps it is easier for the CTH to check for a form to have a consistent solution for all servers. Although it would be nice to send a Accept: text/html header along in that case.

2. We no longer send the location headers the CTH expects

Relevant failed run: https://github.com/solid/community-server/runs/5180809325?check_suite_focus=true#step:9:267

This is completely caused by the server. The IDP API was changed to no longer do redirects but instead return JSON objects containing a location field to make it easier to handle the server output on a dynamic HTML page. But of course this breaks systems that did the call directly and did not depend on the HTML behaviour. The easy fix here is to simply also send a location here together with the JSON object. Fortunately CTH does not check the status code, only if the header is there so this actually solves the problem.

This is not completely correct from an HTTP point of view though, so we probably want a more decent solution (although the previous could be used in the meantime). I was thinking of either doing the redirect as usual again, unless a client sends along a specific HTTP header indicating they do not want to do redirects (a different accept header? application/no-redirect+json? 😄), or set up a server specifically that does normal redirect behaviour by removing the class that does this change from the config. Personally I prefer the first solution so we don't need a specific config for the CTH.

Activity

  1. added
    🐛 bug
    on Feb 14, 2022
  2. RubenVerborgh commented on Feb 15, 2022

    @RubenVerborgh
    Member

    I was thinking of either doing the redirect as usual again, unless a client sends along a specific HTTP header indicating they do not want to do redirects

    I do like that direction; and we should still set up a meeting where you walk me through the need of the non-redirect version.

  3. jvherweg commented on Feb 16, 2022

    @jvherweg
    MemberAuthor

    Tested also with the changes from #1166 and PKCE had to be disabled. After that everything works though. This does seem an issue as the Solid OIDC spec states:

    ... this specification assumes the use of the Authorization Code Flow with PKCE

    So this seems to be an issue with the CTH. Can disable this on the server in the meantime though.

    Relevant failed run: https://github.com/solid/community-server/runs/5216797899?check_suite_focus=true#step:9:159

    /cc @edwardsph

  4. edwardsph commented on Feb 18, 2022

    @edwardsph

    Thanks for the warning about these issues. They have all been resolved in CTH v1.1.3 via solid-contrib/conformance-test-harness#180. In particular:

    • The login page request now includes the Accept: text/html header for compatibility and continues to check for the existence of the form.
    • If the response to the login is a 302 it uses the location header as normal but if the response is a 200 it looks for the location value in the response body. It does a simple regex here as I assumed the response body was not a standard JSON format so didn't want to over-engineer something that might change.
    • The token request now supports PKCE

    This still works for CSS v2 and now supports v3 (whether you stick with the redirect or not).

  5. jvherweg commented on Feb 21, 2022

    @jvherweg
    MemberAuthor

    That's great Pete, thanks! ^^

    Going to leave this issue open for now since we might still want to look at what we do with the redirects.

  6. jvherweg commented on Feb 25, 2022

    @jvherweg
    MemberAuthor

    Going to leave this issue open for now since we might still want to look at what we do with the redirects.

    We have decided to keep this behaviour for now (with some extra explanation in the code eceb710 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions