Skip protection in CLI/maintenance context#34
Open
malberts wants to merge 1 commit into
Open
Conversation
CrawlerProtection guards anonymous web requests. In a CLI/maintenance context there is no request or crawler to protect against, and when a maintenance script re-parses a page that transcludes a protected special page the anonymous-user check fires and denies access. With $wgCrawlerProtectionRawDenial = true that denial calls die(), terminating the entire maintenance run. Return early from checkPerformAction() and checkSpecialPage() when MW_ENTRY_POINT is 'cli' so protection never acts on the command line. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
malberts
force-pushed
the
skip-protection-in-cli
branch
from
July 20, 2026 10:26
1af611b to
008302c
Compare
malberts
marked this pull request as ready for review
July 20, 2026 11:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #33
CrawlerProtection guards anonymous web requests. In a CLI/maintenance context there is no request or crawler to protect against, and when a maintenance script re-parses a page that transcludes a protected special page, the anonymous-user check fires and denies access. With
$wgCrawlerProtectionRawDenial = truethat denial callsdie(), terminating the entire maintenance run (refreshLinks,rebuildData,runJobs, etc.).This returns early from
checkPerformAction()andcheckSpecialPage()whenMW_ENTRY_POINT === 'cli', so protection never acts on the command line.Verification
On a clean MediaWiki 1.43 install with
$wgCrawlerProtectedSpecialPages = [ 'recentchanges' ],$wgCrawlerProtectionRawDenial = true, and a page containing{{Special:RecentChanges}}:php maintenance/run.php refreshLinksprints the denial text and terminates (shell exit 0).AI-authored: Claude Code,
Opus 4.8; fix and clean-room verification for @malberts, confirmed on MediaWiki 1.43; reviewed by @malberts.