Skip to content

fix(users): validate organisation names at write time and confirm reassignment - #169

Merged
gibbsie merged 3 commits into
mainfrom
fix/org-name-validation
Sep 18, 2026
Merged

gibbsie merged 3 commits into
mainfrom
fix/org-name-validation

Conversation

@gibbsie

@gibbsie gibbsie commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • adminCreateUser / assignUserRole reject an organisation name that does not resolve to a live name-reservation row (exact match, no normalisation) before any Cognito write.
  • Organisation reassignment revokes the target's sessions (AdminUserGlobalSignOut, one new scoped IAM action); Team.tsx confirms the reassignment naming user, old/new organisation and the sign-out.
  • createDataStore stamps the caller's organisation and ignores the client orgId (schema unchanged).

Resolves finding 639aeb12; client/UX half of d34ac46f (server half landed in #168).

Deploy note

  • Organisations created before the name-reservation mechanism have no NAME# row and would fail validation. Run backend/scripts/backfill-org-name-reservations.ts against dev before deploying this.
  • Sign-out revokes refresh tokens; already-issued access/ID tokens remain valid until they expire.

Verification

  • backend jest: 8090 passed, tsc clean
  • frontend jest: 2097 passed, tsc clean

Oliver Gibbs added 3 commits September 18, 2026 07:32
… on reassignment

adminCreateUser and assignUserRole now reject an organisation name that
does not resolve to a live name-reservation row (exact match, no
normalisation; tombstoned names rejected with their own message) before
any Cognito write, so a claim can no longer be stamped with a value that
matches no organisation. When assignUserRole changes the organisation it
revokes the target's sessions with AdminUserGlobalSignOut so a stale
tenancy claim cannot outlive the refresh token; the resolver role gains
that single action scoped to the user pool.
…tead of comparing the client value

The client-supplied orgId is no longer trusted or compared; the record,
the idempotency query and the secret path all use the organisation
derived from the caller's claim. The input field stays in the schema for
compatibility and is ignored.
…er's tenancy

The Change Organization action on an active user now opens a confirmation
naming the user, the current and target organisation, and that they will
be signed out of all sessions, instead of applying silently.
@gibbsie
gibbsie merged commit ed233e2 into main Sep 18, 2026
15 checks passed
@gibbsie
gibbsie deleted the fix/org-name-validation branch September 18, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant