You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 529a5de
Browse filesBrowse the repository at this point in the historyBrowse files
Member accounts were named after the address they were admitted with, so every enumeration defence in
this extension worked around that name, and each release found another place where MediaWiki prints
one.
Members now get an opaque name: `Member` plus six characters drawn with `random_int` from a 32-symbol
alphabet, checked for availability against the primary database rather than a replica, and redrawn on
a collision. Names are never reused, since a removed member's account stays. The address lives only in
the account's confirmed email and in the roster, which is already how the extension looks members up:
a code login for a known address lands in the account the roster names, and an address the roster has
never seen gets an account of its own.
Where to look hardest: `MediaWikiUsernameMinter` (the primary read and the retry), the two wrappers in
`RegistrationHandler::nameTheMembersSingleSignOnAdmits()`, the shape check in
`SsoAuthorizationHandler::admitANewAccount()`, and the two selections in `OpaqueNameUpdate`.
### Single sign-on
The PluggableAuth plugin settles on the username before this extension is consulted. OpenIDConnect
gives a say over both the address and the name, in that order within one login: the extension wraps
`OpenIDConnect_EmailProcessor` to learn the address the plugin resolved — not always in the token
payload a processor is handed, since the plugin falls back to the userinfo endpoint — and
`OpenIDConnect_PreferredUsernameProcessor` to mint an opaque name when the allowlist admits that
address. Processors the wiki configured itself run first and are kept; a login the allowlist does not
admit keeps the plugin's name.
Other plugins offer no such hook, so a new allowlisted login arriving through one is refused rather
than provisioned under an identifying name: the member sees PluggableAuth's authorization-failed page
and the `MemberAccess` log channel says why. Members who already have an account are admitted by the
roster as before, whatever the plugin. Holding single sign-on to the allowlist therefore requires
OpenIDConnect; the README states this under platform requirements, with the settings that bypass the
hook (`UseRandomUsernames`, a per-provider processor, `MigrateUsersByUserName`). `MigrateUsersByEmail`
does not bypass it — it attaches the login to an existing account, which the roster then judges — and
is what joins the code-route account and the single sign-on login of one address.
### Removed
The `@` in `$wgInvalidUsernameCharacters`, the `$wgUserrightsInterwikiDelimiter` flip, and the rename
step of member removal — removal is now: forget the roster row, invalidate the address, invalidate the
sessions. `RemovalResult::ReservedNameTaken`, `RemovalFailed` and the `reserved_name_taken` and
`removal_failed` REST error codes went with it; the admin panel, their only consumer, no longer
receives them.
### Kept as defence in depth
The reader-group revocations and provenance rule, the password veto and password-reset filtering, the
blocked special pages and API modules, and the `newusers`, `block` and `renameuser` log restrictions —
the last because the migration renames through `RenameuserSQL`, whose log entry names the old username.
### Migration
A `LoadExtensionSchemaUpdates` callback, run by every `update.php`, renames roster members whose name
the extension did not mint (single sign-on members carry their provider's name, with no `@` in it) and
reader-group accounts with no roster row whose name holds an `@`; a reader-group account with neither
is left alone, since a wiki may point the group at one it already had. Members cannot edit, so the
rename touches the account, its actor row, its log entries and any block on it; the old name survives
only in the restricted rename log, and nothing reverses it. It runs as a `MemberAccess` system user,
taking over an existing account of that name and reserving it from then on; it logs by user id, and on
failure by exception class alone, since a database error message carries the statement and with it
the name. A second run finds nothing. `User:` pages keep their old titles and core logs both names at
debug level; the README's `update.php` paragraph says both.
### Verification
846 tests, up from 763 on master; phpcs and phpstan clean; every new test seen failing against a
mutation of the code it covers. Browser-verified on MediaWiki 1.43: a first login minted
`Member LWDOHG` with the address confirmed and the reader group, the same address returned to that
account, `update.php` renamed two legacy accounts keeping address, confirmation and group, and
`Special:ListUsers` stayed refused.
### Known limitation
`memberaccess_member.mam_email` has no unique index. Two first logins for one address in flight — two
browser tabs — each get an account and a roster row, as does an address admitted by code that later
arrives by single sign-on without `MigrateUsersByEmail`. The index alone would leave the losing
account roster-less and refused at every later login; fixing it also needs the `ignore()` dropped
from the roster insert and a dedupe step in the updater.
Also omitted: a configurable name prefix, forcing `MigrateUsersByUserName` off from code, and moving
`User:` pages in the migration.
### Related
Follows-up to #23 and
#25.
#22,
#24 and
#26 each close one place that prints a
username; with an opaque name they become defence in depth rather than the only defence, so none is
closed by this.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: i18n/qqq.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -34,13 +34,13 @@
34
34
"memberaccess-auth-code-outstanding": "Shown on the code entry screen when no new code was sent, so the one already sent is what to enter. Parameters:\n* $1 - the email address the code was sent to",
35
35
"memberaccess-auth-code-expired": "Error shown when the code is used up, expired, or out of attempts.",
36
36
"memberaccess-auth-not-authorized": "Error shown when a correct code was entered but the address is not on the allowlist.",
37
-
"memberaccess-auth-failed": "Error shown when logging in cannot continue: the session lost track of the code request, the address cannot become a username, or that username belongs to a different account. Deliberately vague; only the first case is fixable by requesting a new code.",
37
+
"memberaccess-auth-failed": "Error shown when a code login cannot continue, for any of several internal reasons. Deliberately vague, so keep the translation unspecific rather than naming a cause.",
38
38
"memberaccess-auth-password-refused": "Error shown when setting or resetting the password of a member account is attempted.",
39
39
"memberaccess-api-module-denied": "Action API error shown when a member asks for a query module that lists the wiki's accounts.\n\nParameters:\n* $1 - the name of the query submodule, for example allusers",
40
40
"memberaccess-special-page-denied": "Error page shown when a member opens a special page that lists or resolves the wiki's accounts.",
41
41
"memberaccess-block-reason": "Reason recorded in the block log when a member is deactivated. Reactivation recognises the extension's own block by this text in the wiki's content language: after a rewording, blocks placed under the old wording are reported as foreign instead of lifted.",
42
42
"memberaccess-unblock-reason": "Reason recorded in the block log when a member is reactivated.",
43
-
"memberaccess-rename-reason": "Reason recorded in the rename log when a member is removed.",
43
+
"memberaccess-opaque-name-reason": "Reason recorded in the rename log when the update that gives members opaque usernames renames a member account.",
0 commit comments