Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients generated from OpenAPI specification cannot handle Passkey authentication method #4063

Open
4 of 5 tasks
Saancreed opened this issue Aug 28, 2024 · 0 comments
Open
4 of 5 tasks
Labels
bug Something is not working.

Comments

@Saancreed
Copy link
Contributor

Preflight checklist

Ory Network Project

No response

Describe the bug

OpenAPI spec for Kratos does not include passkey as a valid option for authentication method enum, here:

kratos/spec/api.json

Lines 1960 to 1974 in b0111d4

"method": {
"enum": [
"link_recovery",
"code_recovery",
"password",
"code",
"totp",
"oidc",
"webauthn",
"lookup_secret",
"v0.6_legacy_session"
],
"title": "The method used",
"type": "string"
},

This causes some clients generated with openapi-generator that explicitly try to match enum values against all known valid values (e.g. csharp generator with generichost library option, as seen here: https:/leancodepl/dotnet-kratos-client/blob/bbaa34a1e7cd355b0c0c34eaa875096dbd529df2/src/LeanCode.Kratos.Client/Model/KratosSessionAuthenticationMethod.cs#L123-L153) to fail at deserializing sessions which were authenticated using passkeys, and therefore failing to authenticate users using this method.

Reproducing the bug

  1. Generate a client from OpenAPI specification that handles enums by matching them against all known valid values.
  2. Obtain a session that includes
  "authentication_methods": [
    {
      "method": "passkey",
      "aal": "aal1",
      "completed_at": ""
    }
  ],
  1. Try to call /sessions/whoami endpoint using that session's token/cookie with generated client and have it deserialize the response.

Relevant log output

No response

Relevant configuration

selfservice:
  methods:
    passkey:
      enabled: true
      config:
        rp:
          display_name: "${authority_name}"
          id: "${domain}"
          origins:
            - "https://${domain}"
%{ for origin in passkey_origins ~}
            - "${origin}"
%{ endfor ~}

Version

1.2.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes

Additional Context

Technically the Kratos version I'm running is v1.2.0 with a custom patch on top of it that enables passkeys for API clients/flows as well. However, it shouldn't matter because the problem was found with a browser client anyway.

The client was actually generated from https:/ory/sdk/blob/master/spec/kratos/v1.2.0.json although it seems like files in both repos have this issue. But I imagine the fix needs to happen here before being propagated to sdk repo so this is where I chose to report this.

@Saancreed Saancreed added the bug Something is not working. label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

1 participant