GeezerVison is showing github.com — Counsellors' real names are written into the Matrix profile, against ADR-002 §2 · Issue #1200 · OpenResilienceInitiative/ORISO-UserService
Counsellors' real names are written into the Matrix profile, against ADR-002 §2 #1200DescriptionAffected repos: ORISO-UserService
Why
ConsultantDisplayNameResolver exists to enforce one invariant, and its own documentation states it plainly: "the display name to register with Synapse, never the counsellor's real name" (ADR-002 §2 — a counsellor's Matrix display name must never reveal more than the room's member list already does).
Two paths bypass that resolver and write the real name instead:
CreateConsultantSaga provisions the Matrix account with firstName + " " + lastName.
ConsultantUpdateService rewrites the Matrix display name to firstname + " " + lastname on every admin edit that touches identity data.
Those are exactly the two paths an admin uses. The resolver is honoured only in the room-provisioning paths (AssignEnquiryFacade, AgencySilentMembershipService, DirectSessionMatrixRoomService).
Why it matters
The Matrix profile display name is readable by every member of a shared room, including the advice seeker, straight from /joined_members — the resolver's own class comment says so. So a newly created counsellor's real name is exposed to advice seekers, and an admin correcting a typo in the surname re-exposes it. The Element Call surface reads the same Matrix profile, which is why a call shows a name nobody chose to publish.
Found while mapping identity synchronisation for #1198 (2026-09-19), from a code read of origin/dev.
What to build
- Route both admin paths through
ConsultantDisplayNameResolver so the registered name is the public display name, falling back to the transcoded username.
- Cover the invariant with tests, so the next refactor cannot quietly reintroduce the real name.
- Repair existing accounts: a one-off reconciliation that rewrites Matrix profiles provisioned with a real name.
Goal
A counsellor's Matrix profile never carries their real name, on any path, and a test proves it.
Acceptance criteria:
- Creating a consultant registers the public display name (or the transcoded username when none is set) — never first/last name.
- Editing a consultant's first or last name does not change the Matrix display name to the real name.
- A test asserts the invariant for the create path and for the update path.
- Existing consultants whose Matrix profile holds a real name are reconciled, and the reconciliation is reported.
Reviewer test plan
- Create a consultant with a public display name → read the Matrix profile → it is the display name.
- Create a consultant without a display name → the profile shows the transcoded username, not the real name.
- Edit the surname of an existing consultant → the Matrix profile is unchanged (or updated to the display name), never to the real name.
- As an advice seeker in a shared room, read
/joined_members → no counsellor real name appears.
Notes on the healthy paths
Deletion is fine: DeleteMatrixConsultantAction is wired into DeleteUserAccountService and deactivates/erases the Matrix user, with three test classes covering it. No change needed there.
Part of #1198. ActivityStorypapst commented on Sep 19, 2026 CollaboratorAuthor More actions PR open for review: #1202 (branch fix/1200-matrix-displayname-never-real-name, target dev, reviewer @shazia-k).
All three Matrix provisioning paths now go through ConsultantDisplayNameResolver; no firstName + " " + lastName reaches Matrix from anywhere in src/main.
CreateConsultantSaga (admin/import consultant creation)
ConsultantUpdateService — admin panel and the self-service PUT /users/consultants entry point, which funnels into the same service
GrantConsultantIdentityService — third call site, not in the original report. Its javadoc says it "mirrors CreateConsultantSaga"; it mirrored the defect too. Fixed in the same PR because it is the same invariant.
The resolver gained a raw-parts overload (publicDisplayName, username) so the creation paths and the Admin-based grant path can use the same rule without copying it. The resolver remains the only place that decides.
Verified locally with JDK 21: 149 tests green across the unit tests and the four Spring integration tests for the touched classes, plus package. Reverting only the three resolver calls turns 7 tests red, including a regression guard that scans every argument handed to MatrixUserClient.
No reconciliation job for already-provisioned Matrix profiles (decided against — dev and pre-dev hold test data only); existing profiles self-heal on the next identity update.
Not addressed here, out of scope by instruction: real names still flow into the counsellor-rename notification payload (ConsultantUpdateService.emitCounselorRenameNotificationsIfNeeded) and into Keycloak's profile. Those belong to the separate identity-sink audit. Storypapst commented on Sep 19, 2026 CollaboratorAuthor More actions Follow-up after an adversarial review of #1202 — a fourth leak, on a different Matrix surface.
CaseHandoverService.resolveConsultantName fell back to Consultant#getFullName() whenever the public display name was blank. That value is serialized into the username field of the CASE_HANDOVER_GRANTED m.text event — a persisted message in the advice seeker's own session room — and substituted into the client copy, so it appeared twice. The trigger was a blank displayName, i.e. exactly the counsellors ADR-002 §2 exists to protect: after the displayname fix alone, their Matrix profile would have shown a pseudonym while their real name sat in a chat message in the same room. It now asks ConsultantDisplayNameResolver like every other path. The username field itself is unchanged; only its value stops being the real name.
Also in #1202: the regression guard was rewritten. The first version compared arguments for equality and missed reversed order, inserted middle names, doubled or surrounding whitespace, differing capitalisation, the name embedded in a longer string, "Musterfrau, Angela", and the name nested inside a serialized payload or JSON body. It now walks arguments recursively, normalises case and punctuation, and matches both name parts as a substring in either order. Measured: the old guard caught 1 of 13 leaking spellings, the new one catches 13 of 13.
Verified locally on JDK 21 (not 25 — Mockito's inline mock maker and Spotless both fail there): 295 tests across 15 classes including 4 Spring integration tests, 0 failures, plus package.
Blocker for this epic, not fixed here: #1201. ConsultantUpdateService still pushes firstName + " " + lastName into createCounselorRenamedNotification, addressed to the advice seeker, from adjacent lines on the same trigger. A notification is pushed to the client rather than merely readable, so until #1201 lands an admin rename still names the counsellor in the notification centre. Out of scope for #1202 by instruction.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|