Page MenuHomePhabricator

hCaptcha VisualEditor: hCaptcha token is reused if AbuseFilter blocks the edit
Closed, ResolvedPublicBUG REPORT

Description

Summary

The VisualEditor integration with hCaptcha submits a hCaptcha response token alongside the API request. If this API request fails because an AbuseFilter denies the edit, the next attempt to save the edit without closing the save changes dialog will cause the request to reuse the token

Steps to reproduce

  1. Open the VisualEditor editor with a user who lacks the skipcaptcha right
  2. Change the page in a way which should trigger an AbuseFilter to deny the edit
  3. Open the save changes dialog and submit the edit
  4. Press "retry" when greeted with the notice that an abusefilter has denied the edit (without closing the save changes dialog)

image.png (1,104×419 px, 64 KB)

Acceptance criteria

  • The hCaptcha response token is not used in the VisualEditor handler for more than one request, and so is regenerated for each edit attempt

Related Objects

Event Timeline

Change #1294287 had a related patch set uploaded (by Mpostoronca; author: Mpostoronca):

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: Regenerate VisualEditor captcha token per save attempt

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

Change #1294287 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: Regenerate VisualEditor captcha token per save attempt

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

Change #1294925 had a related patch set uploaded (by Dreamy Jazz; author: Mpostoronca):

[mediawiki/extensions/ConfirmEdit@wmf/1.47.0-wmf.4] hCaptcha: Regenerate VisualEditor captcha token per save attempt

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

Change #1294925 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@wmf/1.47.0-wmf.4] hCaptcha: Regenerate VisualEditor captcha token per save attempt

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

Mentioned in SAL (#wikimedia-operations) [2026-05-28T08:40:06Z] <dreamyjazz@deploy1003> Started scap sync-world: Backport for [[gerrit:rECTX1294925ea6c7|hCaptcha: Regenerate VisualEditor captcha token per save attempt (T427334)]]

Mentioned in SAL (#wikimedia-operations) [2026-05-28T08:41:49Z] <dreamyjazz@deploy1003> dreamyjazz: Backport for [[gerrit:rECTX1294925ea6c7|hCaptcha: Regenerate VisualEditor captcha token per save attempt (T427334)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-05-28T08:49:26Z] <dreamyjazz@deploy1003> Finished scap sync-world: Backport for [[gerrit:rECTX1294925ea6c7|hCaptcha: Regenerate VisualEditor captcha token per save attempt (T427334)]] (duration: 09m 20s)

Backported to wmf.4 so that we could potentially deploy VisualEditor hCaptcha to Group 1 this week

I tested that the bug was fixed on testwiki with this patch so I think we can resolve this