Skip to content

Skip protection in CLI/maintenance context#34

Open
malberts wants to merge 1 commit into
mywikis:mainfrom
malberts:skip-protection-in-cli
Open

Skip protection in CLI/maintenance context#34
malberts wants to merge 1 commit into
mywikis:mainfrom
malberts:skip-protection-in-cli

Conversation

@malberts

@malberts malberts commented Jul 20, 2026

Copy link
Copy Markdown

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 = true that denial calls die(), terminating the entire maintenance run (refreshLinks, rebuildData, runJobs, etc.).

This returns early from checkPerformAction() and checkSpecialPage() when MW_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}}:

  • Before: php maintenance/run.php refreshLinks prints the denial text and terminates (shell exit 0).
  • After: it completes both phases (link refresh + illegal-entry cleanup) with no denial.

AI-authored: Claude Code, Opus 4.8; fix and clean-room verification for @malberts, confirmed on MediaWiki 1.43; reviewed by @malberts.

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
malberts force-pushed the skip-protection-in-cli branch from 1af611b to 008302c Compare July 20, 2026 10:26
@malberts
malberts marked this pull request as ready for review July 20, 2026 11:07
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.

[Bug] CrawlerProtection kills CLI/maintenance scripts when a parsed page transcludes a protected special page

1 participant