Skip to content

Canonicalize multilingual special-page aliases and surface proxy block hints - #70

Draft
jeffw16 with Copilot wants to merge 2 commits into
mainfrom
copilot/support-multilingual-special-page-translations
Draft

Canonicalize multilingual special-page aliases and surface proxy block hints#70
jeffw16 with Copilot wants to merge 2 commits into
mainfrom
copilot/support-multilingual-special-page-translations

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Special-page protection only matched the configured name form, which could miss requests arriving through localized aliases. This change canonicalizes special-page names from the request path/title and exposes the content-language aliases on denied responses so reverse proxies can block equivalent URLs consistently.

  • Canonicalize multilingual special-page names

    • Normalize configured protected special pages through SpecialPageFactory::resolveAlias()
    • Resolve the incoming request title to the canonical special-page name before protection checks
    • Keep matching case-insensitive and prefix-agnostic (Special:, localized namespace names, alias forms)
  • Surface proxy-facing alias metadata

    • Add X-CrawlerProtection-Special-Page-Aliases on denied special-page responses
    • Include the canonical Special: title plus known content-language aliases for that page
    • Preserve existing denial behavior; this only adds machine-readable alias hints for front-facing filters
  • Wire alias resolution through services

    • Inject SpecialPageFactory and content language into CrawlerProtectionService
    • Keep hook handling thin and leave normalization/alias expansion in the service layer
  • Regression coverage

    • Add unit coverage for:
      • canonicalizing configured localized aliases
      • canonicalizing request titles before denial
      • emitting the alias header
    • Extend integration coverage to assert the new denial header on protected special pages

Example:

$wgCrawlerProtectedSpecialPages = [ 'Spezial:Linkliste' ];

A request for either of these will now resolve to the same protected canonical page:

Special:WhatLinksHere
Spezial:Linkliste

And denied responses include:

X-CrawlerProtection-Special-Page-Aliases: Special:WhatLinksHere, Spezial:Linkliste

Copilot AI review requested due to automatic review settings July 31, 2026 22:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Co-authored-by: jeffw16 <11380894+jeffw16@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 31, 2026 22:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI changed the title [WIP] Add support for multilingual special page translations Canonicalize multilingual special-page aliases and surface proxy block hints Jul 31, 2026
Copilot AI requested a review from jeffw16 July 31, 2026 22:22
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.

[Feature request] Support for multilingual special page translations

3 participants