Page MenuHomePhabricator

Deleted revisions are not counted when viewing a diff
Open, Needs TriagePublicBUG REPORT

Description

Steps to Reproduce:
View the linked pages

  1. https://de.wikipedia.org/w/index.php?title=Serben&oldid=208187411&diff=209946284
  2. https://de.wikipedia.org/w/index.php?title=Serben&diff=209946284&oldid=207851498

Actual Results:
Note that when opening the first link which shows the diff between the revision before and the revision after the deleted one, you don't see anything like "(One intermediate revision by 2 users not shown)" or "(Eine dazwischenliegende Version von 2 Benutzern wird nicht angezeigt)" in German. When opening the second link, it shows the message "(One intermediate revision by 2 users not shown)" or "(Eine dazwischenliegende Version von 2 Benutzern wird nicht angezeigt)". (From diff-multi-otherusers ) The second link shows the revision before the revision before the deleted one.

What happens is, the deleted revision is not counted as a revision but the author is counted.

Expected Results:
Depending on the link, the appropriate of the following messages is shown:

  1. (One intermediate revision by one user not shown)
  2. (2 intermediate revision by 2 users not shown)

Event Timeline

This bug was reported again at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Incorrect_diff_description_when_edits_in_between_are_suppressed_or_revision_deleted and I was curious enough to investigate it.

There seem to be two problems that lead to this:

  1. In RevisionStore::getRevisionIdsBetween() and ::countRevisionsBetween(), we don't return/count revisions where the content has been hidden. This was originally added in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/552278, and it was actually noted in code review there that the code "restricts more than it needs to" (scroll to the comments at the very bottom by Anomie), but these comments were not followed-up on.
  2. In DifferenceEngine::getMultiNotice(), there's additional logic to "only count revisions that are visible". This was added in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/961955 as a security fix for T341529. I think this security bug report was actually a misunderstanding of problem 1 – when the interface was reporting that there were "intermediate revisions by the same user", and some of those revisions' authors were hidden, it was not leaking their usernames, but rather it was just ignoring those revisions entirely and displaying a wrong message.

If we wanted to fix it:

  1. We should return/count all revisions in those methods. The existence of revisions with hidden content/metadata is not secret in MediaWiki; you can see them all in every page history. However, changing this would require reviewing all uses of those methods to make sure none of them rely on their current behavior, and omit the permissions checks for displaying the content or metadata.
  2. We should make the "intermediate revisions" message report when some or all of the authors of the intermediate revisions are hidden. I'm not sure how to phrase that; maybe we could just say that there are "revisions by N or more users" when some authors are hidden, only counting the visible authors. This would require some changes to RevisionStore::getAuthorsBetween(), since it currently doesn't return any information about hidden authors (it behaves as if those revisions did not exist).

Overall this seems a bit tricky, but doable. I won't work on it right now, but I would happily review a patch if anyone wanted to write one.

  NODES
Note 3
Project 1
USERS 5