Page MenuHomePhabricator

hCaptcha DiscussionTools: hCaptcha token reused if AbuseFilter denies the edit
Closed, ResolvedPublicBUG REPORT

Description

Summary

The DiscussionTools 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 will fail because a new hCaptcha token is not generated

Steps to reproduce

  1. Open the DiscussionTools editor with a user who lacks the skipcaptcha right
  2. Write a comment which should trigger an AbuseFilter to deny the edit (on testwiki writing the abuse filter will block this will do this)
  3. Press save changes
  4. Press save changes again

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

Acceptance criteria

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

Event Timeline

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

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

[mediawiki/extensions/ConfirmEdit@master] CaptchaWidget: Rename updateForCaptchaFailure to updateForFailure

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

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

[mediawiki/extensions/DiscussionTools@master] ReplyWidget: Update CAPTCHA for all failed edits

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

Change #1294295 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] CaptchaWidget: Rename updateForCaptchaFailure to updateForFailure

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

Change #1294379 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] ReplyWidget: Update CAPTCHA for all failed edits

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

dom_walden subscribed.

On testwiki without these fixes:

  1. Open a DT reply or new topic
  2. Make trigger AF disallow consequence by writing disallow in edit summary
  3. See warning from AF that I have triggered a filter
  4. Remove disallow from edit summary so AF is not triggered
  5. Attempt to submit reply: unsuccessful
  6. Attempt to submit reply again: successful

On my local wiki with these fixes:

  1. Open a DT reply or new topic
  2. Make trigger AF disallow consequence by writing disallow in edit summary
  3. See warning from AF that I have triggered a filter
  4. Remove disallow from edit summary so AF is not triggered
  5. Attempt to submit reply: successful
Dreamy_Jazz closed this task as Resolved.EditedTue, Jun 2, 10:09 AM

Thanks, regarding step 5 on testwiki this seems like a bug but we are currently improving the flow such that an AbuseFilter CAPTCHA should automatically resubmit in T426476: DiscussionTools hCaptcha: When user encounters AbuseFilter hCaptcha challenge no indication is shown they need to resubmit their edit

If it isn't improved by that ticket, we can always revisit it