Skip to content

PATCH connection end_user clears its existing organization #7297

Description

@LevSky22

Describe the bug

PATCH /connections/{connectionId} accepts end_user, but the request schema does not accept the end user's existing organization. Updating an organization-linked end user therefore clears its native organization fields.

This is still present on master at 8de834738.

Reproduction

  1. Create a connection through a Connect session with both end_user and organization.
  2. Confirm GET /connection/{connectionId} returns end_user.organization.
  3. Send:
PATCH /connections/{connectionId}?provider_config_key={integrationId}
Content-Type: application/json

{
  "end_user": {
    "id": "user-123",
    "email": "user@example.com",
    "display_name": "Updated name"
  }
}
  1. Read the connection again.

Actual behavior

The end user's organization becomes null.

handlePatchConnection calls EndUserMapper.apiToEndUser(body.end_user) without an organization. The mapper converts that omission to organization: null, and the subsequent end-user update writes null organization fields.

Expected behavior

Updating only end_user identity fields should preserve the existing organization. Alternatively, the PATCH schema should accept an explicit organization update and distinguish omission from clearing.

Additional impact

An end user may be linked to multiple connections. Updating its shared row through one connection can therefore clear the organization for every linked connection.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions