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

Server crashes when using OCID connection + Sign in with Apple #4701

Open
piscis opened this issue Nov 22, 2024 · 0 comments
Open

Server crashes when using OCID connection + Sign in with Apple #4701

piscis opened this issue Nov 22, 2024 · 0 comments
Labels

Comments

@piscis
Copy link

piscis commented Nov 22, 2024

We're currently trying to setup CoralTalk together with a OCID ID provider (https://logto.io) using AppleID as a connector. It turns out when OCID token exchange is done the server crashes with a ValidationError: stating that name and picture must be a string and not null.

Because Apple SignIn does not return a "name" or "picture" logto returns a null instead of an empty string. The error seems to be caused in this two lines:

picture: Joi.string(),
name: Joi.string(),

When forcing null values into empty strings before validation everything seams to work:

...
picture: Joi.string().allow(null).default('').custom((value) => value === null ? '' : value),
name: Joi.string().allow(null).default('').custom((value) => value === null ? '' : value),
...

Example of the user user info provided to CoralTalk from LogTo.io after successful authentication via Apple SignIn:

{
    "sub": "lxa7wl57jyjf",
    "name": null,
    "picture": null,
    "updated_at": 1732302616720,
    "username": null,
    "created_at": 1732291345221,
    "organizations": [],
    "organization_data": [],
    "organization_roles": []
}

When forcing null values into empty strings everything seems to work. In case a new user registers and the name is an empty string CoralTalk asks for the username during the registration.

But I do not know if this could have some other implications for CoralTalk. Would be nice if someone could clarify.

Expected behavior:

It would be great if CoralTalk would allow null values for "picture" or "name" to make it possible to connect via login providers like "SignIn with Apple".

At least validation errors in the OCID connector should not crash the server.

Actual behavior:

It crashes the server and makes it impossible to use providers that do not provide name or picture information.

Related Issues:
no

Versions:

  • NodeJS: 14.31.2
  • NPM: 8.0.0
  • MongoDB: 4.2
  • Redis: 3.2
  • Browser: Chrome / Firefox / Safari
  • OS: Ubuntu LTS (AMD64) deployed via docker: coralproject/talk:7
@piscis piscis added the bug label Nov 22, 2024
@piscis piscis changed the title Server crashes when using OCID connection + AppleID Server crashes when using OCID connection + Sign in with Apple Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant