Page MenuHomePhabricator

Special:Undelete shows wrong permission error when viewing deleted contributions in an undefined namespace
Open, Needs TriagePublic

Description

I have several deleted contributions on mediawiki.org in the "Data:" namespace, which no longer exists since T124748. Admins on mediawiki.org can see this at https://www.mediawiki.org/wiki/Special:DeletedContributions/Pppery. These contributions are formatted as Special:BadTitle/NS486:Title, which is fine, and clicking on the big red link gives a bad title page, which is also fine.

image.png (225×1 px, 104 KB)

However, if you click "diff" or "view", it gives the following page:

image.png (153×949 px, 24 KB)

This says "The action you have requested is limited to users in the group: Administrators." even though I am an admin, and can see other deletion logs.

Ideally, these URLs would just work, and display whatever deleted revisions are stored in the database at the invalid title (probably not allowing undeletion). Slightly less ideally, it would give an error message explaining that the title is bad, instead of an error message saying I need permissions that I already have.

Event Timeline

I think we need a script to clean up invalid titles from archive table.

This says "The action you have requested is limited to users in the group: Administrators." even though I am an admin, and can see other deletion logs.

This is just T388989 - nobody has permission to do anything on special pages, so it thinks I don't.

Leaving this open to track the pie-in-the-sky feature that lets you read deleted history for bad titles (which I don't expect anyone to code up), otherwise it's a duplicate of that.

Krinkle renamed this task from Special:Undelete with Special:BadTitle should be supported better to Special:Undelete shows wrong permission error when viewing deleted contributions in an undefined namespace.Aug 25 2025, 2:49 PM
Krinkle updated the task description. (Show Details)

Numerous parts of this are broken or wrong

Starting at https://www.mediawiki.org/wiki/Special:DeletedContributions/Pppery:

(change visibility) 01:08, 26 February 2025 (diff | deletion log | view) 0 m Special:Badtitle/NS486:Json:Wikicon Pppery moved page Module:Foo/bar.json to Data:Json:Wikicon without leaving a redirect

  • change visibility: This tries to load Special:RevisionDelete with target=Special:Badtitle/NS486:Json:Wikicon and ids=7057260.

This renders an Internal server error, and logs a production error to Logstash.

[60e711ec-04b9-4c62-b075-c71348033a76] 2025-08-25 14:50:24: Fatal exception of type "Wikimedia\Assert\PreconditionException"
  • diff and view: These display a "Permissions error" for needing to be an admin, to a user that is an admin. Per the task description.

To a first approximation, it is invalid for database entries to exist that point to undefined namespaces, and we have a maintenance script to rename these (maintenance/cleanupTitles.php, per T124748#10596410). This covers existant pages, but not archived/deleted pages.

One solution would be to cover these as well.

Another solution might be in the form of T20493: RFC: Unify the various deletion systems, as that would make the archived revisions part of the regular revision database table and thus not require a separate solution.

Another solution, temporary, would be to detect this condition in Special:Undelete, and omit these action links from list items with bad titles.

Are deleted pages with bad titles completely inaccessible, or is this one access mechanism that fails while you can still access them in other ways (presumably via the API)?

You can get the revid from the HTML code of Special:DeletedContributions (every row is wrapped in <li data-mw-revid="XXX"></li>) and then https://www.mediawiki.org/w/api.php?action=query&format=json&prop=deletedrevisions&revids=XXX&formatversion=2&drvprop=ids%7Ctimestamp%7Cflags%7Ccomment%7Cuser%7Ccontent will give you the content.

action=undelete is title-based though, so I imagine that won't work. Things like https://www.mediawiki.org/w/api.php?action=query&format=json&prop=deletedrevisions&titles=Data%3AJson%3AWikicon&formatversion=2&drvprop=ids%7Ctimestamp%7Cflags%7Ccomment%7Cuser%7Ccontent certainly don't work. (There is a Data:Json:Wikicon page in the main namespace, but its history is distinct from that of the Json:Wikicon page in the (ex-)Data namespace.)

we have a maintenance script to rename these (maintenance/cleanupTitles.php, per T124748#10596410). This covers existant pages, but not archived/deleted pages.

Filed T402825: cleanupTitles.php should also fix deleted titles about that.

The rest is IMO acceptable behavior when encountering a corrupt database entry (and so I'd decline this task).

Another solution might be in the form of T20493: RFC: Unify the various deletion systems, as that would make the archived revisions part of the regular revision database table and thus not require a separate solution.

For future namespace removals yes, but we'd still need to clean up the revisions which are already broken, or the migration script that turns archived revisions into normal revisions with a deleted flag would need to take special care to handle invalid titles.