Skip to content

Commit 7be5ddf

Browse files
JeroenDeDauwclaude
andcommitted
Drop the account-listing blocks that opaque usernames made pointless
A member's account name identifies nobody, and their address lives in `user_email` and the roster. Three defences were built to keep a member's username, then their email address, out of sight. What they still hide is that members exist, how many there are, and when one joined or was deactivated, which we do not treat as confidential. They are dropped. Two of them were also defects. `Special:Redirect` was closed whole and `Special:FilePath` redirects through it, so every member following a file path landed on a permission error. And `{{Special:ListUsers}}` rendered empty for everyone, staff included, since what a transclusion renders is not kept to the reader who asked for it. Both work again. The rename log stays closed. An entry there names what an account was called before, which for a member can be their email address, and the entry is permanent, so no later change to how members are named takes those names back out of it. Removed: * `UserListSpecialPageHandler`, `$wgMemberAccessBlockedSpecialPages` and the `SpecialPageBeforeExecute` wiring, which restores to members `Special:ListUsers`, `Special:ActiveUsers`, `Special:BlockList`, `Special:Redirect`, `Special:UserRights` read-only, `Special:FilePath`, and the `{{Special:ListUsers}}` transclusion * `UserListApiHandler`, `$wgMemberAccessBlockedApiModules` and the `ApiCheckCanExecute` wiring, which restores the `allusers`, `users` and `blocks` query modules * the `newusers` and `block` log restrictions, leaving both logs as the wiki has them * `memberaccess-api-module-denied` and `memberaccess-special-page-denied`, whose last use went with the handlers, and `getStringListConfig`, whose last caller did * the two settings from the README's configuration table, and the pages, modules and logs from what loading the extension changes; the roster section now states what still holds Kept: the password veto and the password-reset filtering, the decoy codes and uniform responses, the rate limits, the allowlist over single sign-on with its username minting and processors, `$wgBlockDisablesLogin`, the session invalidation on removal, and the reserved `MemberAccess` username. Tests: the two handlers' suites are gone. `RegistrationHandlerTest` pins the rename log as the only log the extension closes, across every route state. `MemberLogVisibilityTest` becomes `RenameLogVisibilityTest`, covering the one log that is still restricted and losing the code-login machinery it needed to make a member. `MemberReadAccessTest` pins the restored surfaces; restoring the two handlers locally turns all five of its cases red, which is what it is there for. Verified on a wiki with member access on, as a reader-group account: `Special:ListUsers` lists accounts under their opaque names, `Special:FilePath/<file>` redirects through to the file, `action=query&list=allusers` answers, `Special:Log/renameuser` is refused, and an administrator sees all of it, the rename log included. Worth weighing: a member the opaque-name update did not rename is now named by their address wherever the wiki names accounts. The update skips an account whose rename fails and writes that to the log channel, so a wiki that has one needs `update.php` to have finished before this is safe. Installation already says to run it after every upgrade. Largely reverts #23 and #25, whose reason for existing went with #29. Considered, omitted: * keeping the special pages blocked and the API modules open, or the reverse; both defended the same thing and neither defends anything now * keeping `Special:Redirect` closed for its user lookups: `Special:Redirect/user/<id>` answers with a name that identifies nobody, and closing it is what broke `Special:FilePath` * leaving the two settings in place with empty defaults, so a wiki could go on blocking pages or modules of its own choosing: deciding who may open which page is the wiki's own access control, not this extension's Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 53cd26c commit 7be5ddf

14 files changed

Lines changed: 263 additions & 871 deletions

‎README.md‎

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ admitted by an allowlist of addresses and domains organized into named groups.
1616
login; deactivating a member blocks them at once.
1717
* Single sign-on logins through [OpenIDConnect] can be held to the same allowlist; staff accounts
1818
are exempt.
19-
* Nothing gives the member list away: a member's account is named after nobody, code and
20-
password-reset requests answer the same for every address, and account listings and the logs that
21-
record members are restricted.
19+
* Nothing says which addresses are members: a member's account is named after nobody, and code and
20+
password-reset requests answer the same for every address.
2221
* An admitted address can be mailed an invitation naming the login page and how to log in.
2322
* Groups, allowlist entries and the member roster are managed over a REST API.
2423
* It does not make the wiki private: restricting who may read stays a wiki configuration decision.
@@ -135,18 +134,12 @@ address hashed.
135134

136135
### The roster
137136

138-
A member's name gives nothing away, so what is left to keep is that they exist at all. The action
139-
API query modules whose purpose is enumerating accounts are closed to the reader group, and three
140-
logs are closed to anyone who cannot manage members: the new user log, where every member's account
141-
creation is recorded, the block log, where every deactivation is, and the rename log, which holds
142-
what members were called before the update that gave them opaque names. Restricting a log type also
143-
keeps it out of recent changes. The special pages that list or resolve accounts are closed to the
144-
reader group as well, and transcluding `Special:ListUsers` renders it empty for everyone, since what
145-
a transclusion renders is not kept to the reader who asked for it. `Special:Redirect` is closed
146-
whole, so members lose its other lookups too, and `Special:FilePath`, which redirects through it.
137+
An account's name identifies nobody, so the wiki's account lists tell a member that other members
138+
exist and no more. The name an account carried before a rename says more, so the rename log is closed
139+
to anyone who cannot manage members, which keeps it out of recent changes as well.
147140

148-
Page histories and recent changes still name whoever acted, which on a members-only wiki means the
149-
staff who edit: members cannot appear there, since they cannot change anything.
141+
Page histories and recent changes name whoever acted, which on a members-only wiki means the staff
142+
who edit: members cannot appear there, since they cannot change anything.
150143

151144
### Login routes
152145

@@ -195,16 +188,13 @@ Whatever the login routes are set to, loading the extension:
195188
sending email, reading the abuse filters and their log, and reading or changing their own private
196189
information or preferences, which closes `Special:ChangeEmail` to them;
197190
* sets `$wgBlockDisablesLogin`, so blocking a member keeps them out of a private wiki;
198-
* restricts the `newusers`, `block` and `renameuser` logs to the `memberaccess-manage` right, unless
199-
the wiki already restricted them, so that who joined, who was deactivated, and what members were
200-
called before the update renamed them stay out of view;
191+
* restricts the `renameuser` log to the `memberaccess-manage` right, unless the wiki already
192+
restricted it, since an entry there names what an account was called before, which for a member
193+
can be their email address;
201194
* reserves the username `MemberAccess`, which the update that renames members records its renames as,
202195
so that no real account can be there for it to take over;
203196
* refuses members a password, whatever the routes: setting one and having a temporary one mailed
204-
stay refused;
205-
* closes the account-listing API modules to the reader group;
206-
* closes the special pages that list or resolve accounts to the reader group, and transcluding
207-
`Special:ListUsers` to everyone.
197+
stay refused.
208198

209199
While the code route is turned on, it also turns off ConfirmEdit's `badloginperuser` captcha trigger,
210200
so failed logins no longer escalate to a captcha for the account they name, for everyone on the wiki
@@ -354,8 +344,6 @@ body it cannot read — carries MediaWiki's error shape rather than this one.
354344
| `$wgMemberAccessIpDailyLimit` | int | `50` | Maximum code requests per client IP within 24 hours |
355345
| `$wgMemberAccessSenderAddress` | ?string | `null` | Address that login codes and invitations are sent from. Falls back to `$wgPasswordSender` |
356346
| `$wgMemberAccessSessionDurationSeconds` | int | `2592000` | How long a remembered login lasts, wiki-wide. Thirty days, against core's 180 days. `0` leaves `$wgExtendedLoginCookieExpiration` alone |
357-
| `$wgMemberAccessBlockedApiModules` | string[] | `[ 'allusers', 'users', 'blocks' ]` | Action API query submodules the reader group may not use |
358-
| `$wgMemberAccessBlockedSpecialPages` | string[] | `[ 'Listusers', 'Activeusers', 'BlockList', 'Redirect', 'Userrights' ]` | Special pages the reader group may not open. Canonical names; an alias does not match. Setting it adds to the shipped list rather than replacing it, so those pages cannot be dropped |
359347

360348
Issued codes and rate-limit counters are held in the main object stash (`$wgMainStash`), which is
361349
database-backed by default. Point it at Redis or Valkey to keep them out of the database.
@@ -427,8 +415,7 @@ Initial version for MediaWiki 1.43+ with these features:
427415
removal closes the account and frees their address for a new one
428416
* Code requests rate limited per email address and per client IP, with a burst and a daily limit,
429417
and codes stored hashed and burned after five wrong entries
430-
* Uniform responses, restricted account-listing API modules and special pages, and restricted new
431-
user, block and rename logs, so the member list is not given away
418+
* Uniform responses and a restricted rename log, so no address is given away
432419
* Every code issue, login success, failure and rate-limit hit logged through the `MemberAccess` log
433420
channel, with the email address hashed
434421
* An invitation mailed to an admitted address on request, and again as often as needed, naming the

‎extension.json‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
"passwordReset": {
3636
"factory": "ProfessionalWiki\\MemberAccess\\MemberAccessExtension::newPasswordResetHookHandler"
3737
},
38-
"api": {
39-
"factory": "ProfessionalWiki\\MemberAccess\\MemberAccessExtension::newUserListApiHookHandler"
40-
},
41-
"specialPages": {
42-
"factory": "ProfessionalWiki\\MemberAccess\\MemberAccessExtension::newUserListSpecialPageHookHandler"
43-
},
4438
"loginForm": {
4539
"class": "ProfessionalWiki\\MemberAccess\\EntryPoints\\LoginFormHandler"
4640
}
@@ -50,8 +44,6 @@
5044
"PluggableAuthUserAuthorization": "sso",
5145
"UserLoggedIn": "login",
5246
"SpecialPasswordResetOnSubmit": "passwordReset",
53-
"ApiCheckCanExecute": "api",
54-
"SpecialPageBeforeExecute": "specialPages",
5547
"AuthChangeFormFields": "loginForm",
5648
"BeforePageDisplay": "loginForm"
5749
},
@@ -145,14 +137,6 @@
145137
"MemberAccessSessionDurationSeconds": {
146138
"value": 2592000,
147139
"description": "How long a remembered login lasts, in seconds. Sets $wgExtendedLoginCookieExpiration while a route can log a member in, so it applies to everyone on the wiki, not only to members. Set to 0 to leave that setting alone."
148-
},
149-
"MemberAccessBlockedApiModules": {
150-
"value": [ "allusers", "users", "blocks" ],
151-
"description": "Names of action API query submodules the reader group may not use."
152-
},
153-
"MemberAccessBlockedSpecialPages": {
154-
"value": [ "Listusers", "Activeusers", "BlockList", "Redirect", "Userrights" ],
155-
"description": "Canonical names of special pages the reader group may not open."
156140
}
157141
},
158142
"RestRoutes": [

‎i18n/en.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
"memberaccess-auth-not-authorized": "This address cannot be used to log in here.",
4242
"memberaccess-auth-failed": "Logging in did not complete. Request a new login code; if this keeps happening, contact an administrator of this wiki.",
4343
"memberaccess-auth-password-refused": "Members log in with a one-time code, so this account cannot have a password.",
44-
"memberaccess-api-module-denied": "The \"$1\" API module is not available to members.",
45-
"memberaccess-special-page-denied": "This special page is not available to members.",
4644
"memberaccess-block-reason": "Membership ended",
4745
"memberaccess-unblock-reason": "Membership resumed",
4846
"memberaccess-opaque-name-reason": "Email addresses are no longer used as usernames",

‎i18n/qqq.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
"memberaccess-auth-not-authorized": "Error shown when a correct code was entered but the address is not on the allowlist.",
4242
"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.",
4343
"memberaccess-auth-password-refused": "Error shown when setting or resetting the password of a member account is attempted.",
44-
"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",
45-
"memberaccess-special-page-denied": "Error page shown when a member opens a special page that lists or resolves the wiki's accounts.",
4644
"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.",
4745
"memberaccess-unblock-reason": "Reason recorded in the block log when a member is reactivated.",
4846
"memberaccess-opaque-name-reason": "Reason recorded in the rename log when the update that gives members opaque usernames renames a member account.",

‎src/EntryPoints/RegistrationHandler.php‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RegistrationHandler {
2121

2222
private const MANAGE_RIGHT = 'memberaccess-manage';
2323
private const PUBLIC_LOG = '*';
24-
private const LOGS_THAT_RECORD_MEMBERS = [ 'newusers', 'block', 'renameuser' ];
24+
private const RENAME_LOG = 'renameuser';
2525
private const PER_ADDRESS_CAPTCHA_TRIGGER = 'badloginperuser';
2626
private const SSO_EMAIL_PROCESSOR_SETTING = 'wgOpenIDConnect_EmailProcessor';
2727
private const SSO_USERNAME_PROCESSOR_SETTING = 'wgOpenIDConnect_PreferredUsernameProcessor';
@@ -45,7 +45,7 @@ public static function onRegistration(): void {
4545
*/
4646
private static function applyWhatMembersNeed(): void {
4747
self::moveReaderRevocationsToTheConfiguredGroup();
48-
self::closeTheLogsThatRecordMembers();
48+
self::closeTheLogThatHoldsMemberAddresses();
4949
self::reserveTheAccountTheRenamesAreRecordedAs();
5050

5151
// A deactivated member is blocked, and only this makes a block keep them out of a private wiki.
@@ -86,24 +86,21 @@ private static function moveReaderRevocationsToTheConfiguredGroup(): void {
8686
}
8787

8888
/**
89-
* Three core logs record members: the new user log, where every account creation is, the block
90-
* log, where every deactivation is, and the rename log, which holds what members were called
91-
* before the update that gave them opaque names. All are closed to everyone who cannot manage
92-
* members, which also keeps them out of recent changes, since a restricted log type is never
89+
* A rename log entry names what an account was called before, which for a member can be their
90+
* email address, and the entry is there for good, so the log is closed to everyone who cannot
91+
* manage members. That also keeps it out of recent changes, since a restricted log type is never
9392
* written there.
9493
*
95-
* A member's name says nothing about them, so what the first two give away is that somebody
96-
* joined or was deactivated, and when. The rename log is the one that still names addresses.
94+
* Every other log names accounts under the names the wiki shows anyway, and a member's name says
95+
* nothing about them, so this is the only log the extension closes.
9796
*
98-
* A wiki that restricted one of them further keeps its own setting.
97+
* A wiki that restricted it further keeps its own setting.
9998
*/
100-
private static function closeTheLogsThatRecordMembers(): void {
99+
private static function closeTheLogThatHoldsMemberAddresses(): void {
101100
$restrictions = self::globalArray( 'wgLogRestrictions' );
102101

103-
foreach ( self::LOGS_THAT_RECORD_MEMBERS as $logType ) {
104-
if ( ( $restrictions[$logType] ?? self::PUBLIC_LOG ) === self::PUBLIC_LOG ) {
105-
$restrictions[$logType] = self::MANAGE_RIGHT;
106-
}
102+
if ( ( $restrictions[self::RENAME_LOG] ?? self::PUBLIC_LOG ) === self::PUBLIC_LOG ) {
103+
$restrictions[self::RENAME_LOG] = self::MANAGE_RIGHT;
107104
}
108105

109106
$GLOBALS['wgLogRestrictions'] = $restrictions;

‎src/EntryPoints/UserListApiHandler.php‎

Lines changed: 0 additions & 107 deletions
This file was deleted.

‎src/EntryPoints/UserListSpecialPageHandler.php‎

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)