fix(auth): close invite, signup, password, and validation defects #203
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pms-192-invite-signup-password-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Make new-user invite acceptance atomic: the tenant membership INSERT moves into the SERIALIZABLE
accept_oncetx in mokosh-auth-storage, so a crash can no longer leave a user with no membership. The org-role is derived from the invite role viaMembershipRole::from_user_roleinstead of being hardcoded to Admin in the HTTP handler, so Member/ReadOnly invites are no longer over-privileged. The fire-and-forget membership create in handlers/invites.rs is removed.Enforce caller-email == invite-email (case-insensitive) in
accept_invitation(handlers/orgs.rs) so a forwarded invite link cannot let a different authenticated user join the org.Stop returning expired invites: add
AND expires_at > NOW()toinvite::list_openandorg_invitation::list_open_for_tenant.Return the DB-clock
consumed_atfrommfa_challenge::consume_onceviaRETURNING consumed_atinstead of echoing the app clock.Check the confirmation match before the password policy and argon2 work in handlers/password_reset.rs, so a mismatch never triggers an expensive hash or leaks policy detail.
Measure password length by Unicode scalar count (
chars().count()) in policy.rs, not byte length, so multi-byte passwords are not miscounted.Stop the pre-2FA data leak:
LoginResponse.useris nowOption<CurrentUser>, set to None (and omitted from JSON) whilemfa_requiredis true; the legacy auth service sets it accordingly.Validate the shared request types:
must_matchon confirm_password for ResetPasswordRequest and ChangePasswordRequest, and a digit-only check on MfaEnableRequest.code.Return NotFound from
membership::set_statuswhen no row is updated, matching the rows_affected guard already used byset_role.#PMS-192
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com