Skip to content

Clean up orphaned invited members

Stan Hu requested to merge sh-clean-up-orphaned-member-invites into master

What does this MR do and why?

Prior to GitLab 14.1.2 (?), it was possible to get entries in the members table that had the following properties:

  1. user_id is null
  2. invite_token is null
  3. invite_accepted_at is non-null

These entries could cause 500 errors when viewing the member list via the UI or API since user was nil.

On GitLab.com, there are 1,336 entries like this, with the newest one created on 2021-08-31.

It's not entirely clear how this happened, but no new orphaned entries have been created since then. Quite possibly it was due to accepting an invite for an e-mail address that was already registered: #371804 (comment 1081761414), but this problem may have been fixed in a security release.

This commit cleans up rows that meet accepted tokens with no associated user.

Database migration timings: !96505 (comment 1081923125)

Relates to #371804 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports