Skip to content

WPB-26291 prevent SCIM user change name on registration#5268

Open
battermann wants to merge 12 commits into
developfrom
WPB-26291-be-scim-scim-provisioned-users-can-change-their-handle-when-assigning-handle-and-password-during-registration
Open

WPB-26291 prevent SCIM user change name on registration#5268
battermann wants to merge 12 commits into
developfrom
WPB-26291-be-scim-scim-provisioned-users-can-change-their-handle-when-assigning-handle-and-password-during-registration

Conversation

@battermann

@battermann battermann commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

It is debatable if we need a new API version. I don't like it but it was agreed upon in the scope's chat because the change is not backwards compatible.

https://wearezeta.atlassian.net/browse/WPB-26291

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@battermann battermann changed the title WPB-26291 add managed_by to teams invitation code info WPB-26291 prevent change name on registration Jun 12, 2026
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Jun 12, 2026
@battermann battermann changed the title WPB-26291 prevent change name on registration WPB-26291 prevent SCIM user change name on registration Jun 15, 2026
@battermann battermann marked this pull request as ready for review June 15, 2026 15:20
@battermann battermann requested review from a team as code owners June 15, 2026 15:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enforces that SCIM-managed invited users cannot change their display name during registration (server-side), while maintaining backwards compatibility by introducing a version-gated /register behavior split (v16 vs v17+). It also enriches the team invitation info response to optionally expose managed_by, and updates golden + integration tests and changelog accordingly.

Changes:

  • Add a v17+ registration guard that rejects SCIM display-name changes during POST /register (new 403 managed-by-scim case), while keeping pre-v17 behavior via register@v16.
  • Extend GET /teams/invitations/info?code=... response with optional managed_by and wire it through Brig.
  • Update golden fixtures and integration tests to cover SCIM invitation info and registration behavior.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
services/brig/src/Brig/Team/API.hs Adds managedBy to invitation info responses by looking up a pending user derived from invitation id.
services/brig/src/Brig/Data/User.hs Introduces invitationIdToUserId helper for SCIM/pending-invitation user id derivation.
services/brig/src/Brig/API/User.hs Adds SCIM display-name guard and splits registration into v16 vs v17+ implementations.
services/brig/src/Brig/API/Public.hs Wires register@v16 and register handlers to the new Brig registration functions.
libs/wire-api/src/Wire/API/User.hs Extends RegisterError union with the new SCIM display-name mismatch case.
libs/wire-api/src/Wire/API/Team/Invitation.hs Adds optional managed_by field to InvitationUserView schema/JSON.
libs/wire-api/src/Wire/API/Routes/Public/Brig.hs Adds version-gated register@v16 endpoint and gates register from v17.
libs/wire-api/test/golden/testObject_InvitationUserView_team_1.json Updates golden JSON to include managed_by.
libs/wire-api/test/golden/testObject_InvitationUserView_team_2.json Updates golden JSON to include managed_by.
libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/InvitationUserView.hs Updates golden Haskell objects to populate managedBy.
integration/test/Test/Teams.hs Adds assertion that non-SCIM invitation info omits managed_by.
integration/test/Test/Spar.hs Adds SCIM registration test asserting name change is rejected with managed-by-scim.
integration/test/SetupHelpers.hs Adjusts invited-user registration helper to reuse invitation-provided name (SCIM-safe).
integration/test/API/Brig.hs Adds registerUserWith to support name-parametrized registration in tests.
changelog.d/3-bug-fixes/WPB-26291 Documents bug fix for SCIM name changes on registration.
changelog.d/1-api-changes/WPB-26291 Documents API change (new error for v17+, optional managed_by on invitation info).

Comment thread services/brig/src/Brig/Team/API.hs Outdated
Comment thread integration/test/SetupHelpers.hs
Comment thread integration/test/Test/Spar.hs Outdated
Comment thread libs/wire-api/src/Wire/API/User.hs
Comment thread changelog.d/3-bug-fixes/WPB-26291 Outdated
battermann and others added 3 commits June 15, 2026 17:33
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Comment thread integration/test/SetupHelpers.hs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants