Skip to content

Add CentralAuth ID read allowlist for restricted wikis - #18

Merged
Zippybonzo merged 2 commits into
mainfrom
claude/bold-newton-z9izb9
Sep 11, 2026
Merged

Zippybonzo merged 2 commits into
mainfrom
claude/bold-newton-z9izb9

Conversation

@Zippybonzo

@Zippybonzo Zippybonzo commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Ports Miraheze's MirahezeMagicAccessIdsMap approach so a wiki (staffwiki) can be locked to an explicit list of CentralAuth user IDs.

  • New config $wgWikiOasisMagicAccessIdsMap: map of dbname => array of CentralAuth user IDs allowed to read that wiki.
  • New UserGetRightsRemove handler on Main: on a mapped wiki, strips the read right from anonymous users and from any registered user whose CentralAuth ID is not in the list.
  • onTitleReadWhitelist gains Userlogin, Userlogout, ChangePassword and PasswordReset, and drops the non-existent ResetPassword, so locked-out users can still reach login/recovery.

Companion config change: WikiOasis/mw-config#30.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QtaPDHkXrw6kD656KeyXah

Summary by CodeRabbit

  • New Features
    • Added wiki-specific access configuration based on approved CentralAuth user IDs.
    • Anonymous users and registered users without authorization can no longer access wiki content.
    • Updated password and account-related title access rules, including password changes, resets, logins, and logouts.

Adds $wgWikiOasisMagicAccessIdsMap and a UserGetRightsRemove handler that
strips the read right on mapped wikis from anyone whose CentralAuth ID is
not in the allowlist, and extends the read whitelist with the special pages
needed to log in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QtaPDHkXrw6kD656KeyXah
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ab15d849-29db-4fae-b1de-e0e5fd34b84c

📥 Commits

Reviewing files that changed from the base of the PR and between 0953603 and 315fdac.

📒 Files selected for processing (2)
  • extension.json
  • includes/HookHandlers/Main.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The extension adds wiki-specific CentralAuth access configuration. Main handles UserGetRightsRemove and removes read rights from anonymous or unauthorized users. The special-page whitelist now includes password and login pages.

Changes

Wiki access control

Layer / File(s) Summary
Access configuration and handler wiring
extension.json, includes/HookHandlers/Main.php
The extension declares WikiOasisMagicAccessIdsMap, registers UserGetRightsRemove, and supplies the configuration to Main.
Read-right enforcement and login page whitelist
includes/HookHandlers/Main.php
Main preserves access for registered users with an authorized CentralAuth ID, removes read for other users, and updates the whitelisted special pages.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant UserGetRightsRemove
  participant Main
  participant WikiOasisMagicAccessIdsMap
  participant CentralAuthUser
  UserGetRightsRemove->>Main: Invoke onUserGetRightsRemove
  Main->>WikiOasisMagicAccessIdsMap: Read IDs for the current wiki
  Main->>CentralAuthUser: Check registration and CentralAuth ID
  Main-->>UserGetRightsRemove: Remove read for unauthorized users
Loading

Merge Risk: ⚪ Minimal · up to 315fd

No merge-blocking risk was established in the reviewed changes.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a CentralAuth ID allowlist for read access on restricted wikis.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/bold-newton-z9izb9

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread includes/HookHandlers/Main.php Resolved
Cast both sides of the allowlist membership check to int so IDs configured
as strings still match CentralAuth's integer ID.

Bump mediawiki/mediawiki-codesniffer to 51.0.1, which requires the patched
php_codesniffer 3.13.6. Composer 2.10 refuses to install 3.13.5 due to
security advisory PKSA-rdkp-vv9z-mjkg, which fails composer install on
every CI leg including main.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QtaPDHkXrw6kD656KeyXah
@Zippybonzo
Zippybonzo merged commit ad53861 into main Sep 11, 2026
4 checks passed
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.

2 participants