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

Identity created with uppercase letter in email cannot be PATCHed #3187

Closed
3 of 6 tasks
sloosch opened this issue Mar 24, 2023 · 1 comment · Fixed by #3330
Closed
3 of 6 tasks

Identity created with uppercase letter in email cannot be PATCHed #3187

sloosch opened this issue Mar 24, 2023 · 1 comment · Fixed by #3330
Assignees
Labels
bug Something is not working.

Comments

@sloosch
Copy link

sloosch commented Mar 24, 2023

Preflight checklist

Describe the bug

Trying to PATCH the verifiable_addresses verified and/or status flag is not possible if the identity was created with an uppercase letter in the email.

Reproducing the bug

  • Use an identity schema with a trait having an email and verification via email enabled.
  • Create a new identity with an email containing a uppercase letter e.g. Test@test.com
  • Try to change the verified status of the newly created identity via PATCH using the admin api of kratos: e.g. kratos running locally with exposed admin port 4434 curl -v -X PATCH --data '@./patch.json' -H 'Content-Type: application/json' http://localhost:4434/admin/identities/<the-identity-id>'
    where patch.json does contain the patch operation:
[
  {
        "op": "replace",
        "path": "/verifiable_addresses/0/verified",
        "value": true
  }
]
  • In the response observe that verifiable_addresses was not updated and does contain a null-id and null-created-at date:
{"id":"c9d94f94-fa72-418f-a5b7-b78702377a19","credentials":{"password":{"type":"password","identifiers":["test@test.com"],"version":0,"created_at":"2023-03-24T10:01:28.041839Z","updated_at":"2023-03-24T10:23:38.077894Z"}},"schema_id":"default","schema_url":"http://127.0.0.1:4433/schemas/ZGVmYXVsdA","state":"active","state_changed_at":"2023-03-24T10:01:28.039621074Z","traits":{"email":"Test@test.com","name":{"first":"Test","last":"Test"}},"verifiable_addresses":[{"id":"00000000-0000-0000-0000-000000000000","value":"test@test.com","verified":false,"via":"email","status":"pending","created_at":"0001-01-01T00:00:00Z","updated_at":"0001-01-01T00:00:00Z"}],"recovery_addresses":[{"id":"00000000-0000-0000-0000-000000000000","value":"test@test.com","via":"email","created_at":"0001-01-01T00:00:00Z","updated_at":"0001-01-01T00:00:00Z"}],"metadata_public":null,"created_at":"2023-03-24T10:01:28.04083Z","updated_at":"2023-03-24T10:01:28.04083Z"}
  • Observe the verifiable_addresses was really not updated by issuing a GET request: curl -v -X GET http://localhost:4434/admin/identities/<the-identity-id>'
  • Repeat the above steps with an email address containing only lowercase letters and the PATCH can be executed

Relevant log output

No response

Relevant configuration

Identity schema

{
    "$id": "https://schemas.ory.sh/presets/kratos/quickstart/email-password/identity.schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Person",
    "type": "object",
    "properties": {
      "traits": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "title": "E-Mail",
            "minLength": 3,
            "ory.sh/kratos": {
              "credentials": {
                "password": {
                  "identifier": true
                }
              },
              "verification": {
                "via": "email"
              },
              "recovery": {
                "via": "email"
              }
            }
          },
          "name": {
            "type": "object",
            "properties": {
              "first": {
                "title": "First Name",
                "type": "string"
              },
              "last": {
                "title": "Last Name",
                "type": "string"
              }
            }
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      }
    }
  }


### Version

0.11.1

### On which operating system are you observing this issue?

Linux

### In which environment are you deploying?

Docker

### Additional Context

_No response_
@sloosch sloosch added the bug Something is not working. label Mar 24, 2023
@DASPRiD
Copy link

DASPRiD commented Apr 8, 2023

Good to know. I assume a workaround for now might be to lowercase all email addresses on registration through the front-end.

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

Successfully merging a pull request may close this issue.

3 participants