Page MenuHomePhabricator

Private tags leaked in logevents API via initialTags field
Closed, ResolvedPublicSecurity

Description

What is the problem?

If a revision has a private tag (e.g. mw-private-personal-info) and I update the tags of the revision (e.g. via Special:EditTags), when using the list=logevents API I can see the private tags in the initialTags field.

For example,

"query": {
        "logevents": [
            {
                "params": {
                    "revid": 2309,
                    "logid": false,
                    "tagsAdded": [
                        "ab"
                    ],
                    "tagsAddedCount": 1,
                    "tagsRemoved": [],
                    "tagsRemovedCount": 0,
                    "initialTags": [
                        "mw-private-personal-info",
                        "mw-reverted",
                        "wikieditor"
                    ]
                }
            },
...

This might affect other API endpoints, as I have not tested all of them.

Steps to reproduce problem
  1. Find a revision (record its <rev id>) and add a private tag to it
  2. Go to index.php?type=revision&title=Special%3AEditTags&ids[<rev id>]=1 and add a tag to it
  3. Go to Special:ApiSandbox#action=query&format=json&list=logevents&formatversion=2&leprop=details&lelimit=10 and make the request
Environment

Wiki(s): local docker WikimediaAntiAbuse – (0d8cd31) 12:13, 28 August 2026.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

To solve this we probably need to filter out all private tags from the initialTags list because we don't have filtering on the log_params field to remove these private tags from database dumps and from log API outputs (and doing that will likely be an expensive LIKE query)

Excluding the private tags has the downside that it's not included in the log even for users who can see it. However:

Longer term I wonder if there is a need for initialTags in the the log entry parameters? However, removing that seems like too much of a wide scope for a security fix

Queries on production appear to show that no-one has yet triggered this on English Wikipedia (and so the fix can be made just in PHP without needing for us to deal with existing leaks of data)

(enwiki)> SELECT * FROM logging where log_type = 'tag' AND log_action = 'update' AND log_params LIKE '%initialTags%private%' LIMIT 1;
Empty set (0.003 sec)

Verified that it stops new tag/update log entries from recording private tag names. +2

SELECT * FROM logging where log_type = 'tag' AND log_action = 'update' AND log_params LIKE '%initialTags%private%' LIMIT 1; still returns no rows on enwiki, so no logging rows need handling retroactively

The private tag feature only exists in MediaWiki 1.47 which has not been released yet. Therefore, this patch can be made public now and so I'm going to upload the patch to the master branch.

mmartorana changed the visibility from "Custom Policy" to "Public (No Login Required)".Mon, Sep 14, 3:33 PM

The feature does not exist in any release version, so no need to put this under T429198: Tracking bug for MediaWiki 1.43.10/1.45.5/1.46.1 (as there will be no security backports to release versions needed and so no need to announce the fix for it)

mmartorana changed the edit policy from "Custom Policy" to "All Users".Mon, Sep 14, 3:44 PM

I cannot reproduce the bug in the description. I tagged all my local revisions and logs with private tags, then I added/removed other tags to them. The private tags did not appear in list=logevents.

I have also tried to find similar leaks in other APIs, but I have not found any yet.