Page MenuHomePhabricator

Allow Client Hints data to be used to prevent the save of edits
Open, Needs TriagePublicFeature

Description

Summary

It should be possible to inspect the value of http-client-hints during an edit to allow customisable actions (such as preventing the edit from being saved)

Background

  • http-client-hints are currently stored for edits post save
    • We did not use HTTP headers because these have cache-pollution issues for logged out editors (specifically we cannot unset the Client Hints HTTP headers if a user was to then while logged out edit the edit page to view an article)
    • We could not go with pre-save or at-save collection via JS because:
      • There are many interfaces that perform edits and we do not have a reliable way to know that an edit has occurred on the front-end until after the edit has been saved (via the 'postEdit' JS hook).
      • The infrastructure that stores HTTP Client Hints data in CheckUser needs a reference ID, which for edits is the revision ID of the edit (making pre-save collection impossible)
      • Modifying the requests to save edits to include Client Hints data is complicated, partly due to the first point but also as the browser may reject attempts to provide some of the requested Client Hints and/or the browser may not support Client Hints
  • There has been a recent need to inspect http-client-hints data to potentially rate-limit or block edits (T401266)
    • However, we cannot inspect the value of the Client Hints until after edits are saved
    • Other actions (like logging out, creating an account, and in some cases logging in) does collect HTTP Client Hints data using HTTP headers so can be inspected for abuse mitigation
      • We can use HTTP headers here because there is a consistent flow where a user loads a page before performing the action (which allows us to set the HTTP headers on the first special page view and then collect the data on the request that submits the form)
        • Not all editing interfaces support that flow, and even then we don't necessarily want to imply we are collecting http-client-hints data when a user hasn't even performed an edit yet (which is another reason why a JS approach was also preferred)

Technical notes

TBD

Acceptance criteria

  • Where possible, http-client-hints data can be inspected during an edit action while allowing this inspection to occur before the edit is saved

Event Timeline

• Dreamy_Jazz renamed this task from Expand ability to block and prevent vandalizing edits with ClientHints to Allow Client Hints data to be used to prevent the save of edits.Aug 13 2025, 12:32 PM

Change #1344143 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/MobileFrontend@master] EditorGateway: Pass the Client Hints field through to the save

https://gerrit.wikimedia.org/r/1344143

Change #1344193 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/DiscussionTools@master] DiscussionTools: use prepareExtensibleApiRequest

https://gerrit.wikimedia.org/r/1344193

Change #1344265 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@master] ClientHints: Introduce helper to read data from request field

https://gerrit.wikimedia.org/r/1344265

Change #1344266 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@master] ClientHints: Read logout data through newFromRequestField()

https://gerrit.wikimedia.org/r/1344266

Change #1344267 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@master] ClientHints: Send high entropy data with an edit request

https://gerrit.wikimedia.org/r/1344267

Change #1344268 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@master] ClientHints: Remove CheckUserClientHintsInEditRequest feature flag

https://gerrit.wikimedia.org/r/1344268

Change #1344620 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/ProofreadPage@master] EditInSequence: Let extensions add data to the save request

https://gerrit.wikimedia.org/r/1344620

Change #1344265 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] ClientHints: Introduce helper to read data from request field

https://gerrit.wikimedia.org/r/1344265

Change #1344266 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] ClientHints: Read logout data through newFromRequestField()

https://gerrit.wikimedia.org/r/1344266

Change #1344143 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] EditorGateway: Pass the Client Hints field through to the save

https://gerrit.wikimedia.org/r/1344143

Change #1344620 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] EditInSequence: Let extensions add data to the save request

https://gerrit.wikimedia.org/r/1344620

Change #1344193 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] DiscussionTools: use prepareExtensibleApiRequest

https://gerrit.wikimedia.org/r/1344193

Change #1344267 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] ClientHints: Send high entropy data with an edit request

https://gerrit.wikimedia.org/r/1344267

Change #1345854 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[operations/mediawiki-config@master] CheckUser: Enable ClientHintsInEditRequest on group0

https://gerrit.wikimedia.org/r/1345854

Change #1345854 merged by jenkins-bot:

[operations/mediawiki-config@master] CheckUser: Enable ClientHintsInEditRequest on group0

https://gerrit.wikimedia.org/r/1345854

Mentioned in SAL (#wikimedia-operations) [2026-09-29T07:22:58Z] <kharlan@deploy1003> Started scap sync-world: Backport for [[gerrit:1345854|CheckUser: Enable ClientHintsInEditRequest on group0 (T401808)]]

Mentioned in SAL (#wikimedia-operations) [2026-09-29T07:27:10Z] <kharlan@deploy1003> kharlan: Backport for [[gerrit:1345854|CheckUser: Enable ClientHintsInEditRequest on group0 (T401808)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-09-29T07:35:39Z] <kharlan@deploy1003> Finished scap sync-world: Backport for [[gerrit:1345854|CheckUser: Enable ClientHintsInEditRequest on group0 (T401808)]] (duration: 12m 41s)

Change #1345950 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/CheckUser@master] ClientHints: Reject list items that hold arrays

https://gerrit.wikimedia.org/r/1345950

Change #1345950 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] ClientHints: Reject list items that hold arrays

https://gerrit.wikimedia.org/r/1345950

Change #1346541 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[operations/mediawiki-config@master] CheckUser: Enable ClientHintsInEditRequest on group1

https://gerrit.wikimedia.org/r/1346541

Change #1346542 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[operations/mediawiki-config@master] CheckUser: Enable ClientHintsInEditRequest on all wikis

https://gerrit.wikimedia.org/r/1346542

Change #1346541 merged by jenkins-bot:

[operations/mediawiki-config@master] CheckUser: Enable ClientHintsInEditRequest on group1

https://gerrit.wikimedia.org/r/1346541

Change #1346542 merged by jenkins-bot:

[operations/mediawiki-config@master] CheckUser: Enable ClientHintsInEditRequest on all wikis

https://gerrit.wikimedia.org/r/1346542

Mentioned in SAL (#wikimedia-operations) [2026-10-01T07:09:31Z] <kharlan@deploy1003> Started scap sync-world: Backport for [[gerrit:1346542|CheckUser: Enable ClientHintsInEditRequest on all wikis (T401808)]], [[gerrit:1346541|CheckUser: Enable ClientHintsInEditRequest on group1 (T401808)]]

Mentioned in SAL (#wikimedia-operations) [2026-10-01T07:15:37Z] <kharlan@deploy1003> kharlan: Backport for [[gerrit:1346542|CheckUser: Enable ClientHintsInEditRequest on all wikis (T401808)]], [[gerrit:1346541|CheckUser: Enable ClientHintsInEditRequest on group1 (T401808)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-10-01T07:24:09Z] <kharlan@deploy1003> Finished scap sync-world: Backport for [[gerrit:1346542|CheckUser: Enable ClientHintsInEditRequest on all wikis (T401808)]], [[gerrit:1346541|CheckUser: Enable ClientHintsInEditRequest on group1 (T401808)]] (duration: 14m 37s)