Page MenuHomePhabricator

hCaptcha: SiteVerify responses with 'already-seen-response' during standard editing flow
Open, Needs TriagePublic

Description

Summary

It seems that somehow a fresh hCaptcha response token is being considered by the siteverify API as already seen but only in reproducible situations. It seems there is some kind of race condition that causes the hCaptcha token to be verified twice

Background

  • All such logs are at https://logstash.wikimedia.org/goto/388a342650ad79d8087bad1e0fd94390
    • Some of these may be expected, which happens if a user makes more than one API request with the same hCaptcha token (as it can only be used once)
    • However, not all of these are that and I have seen this happen when triggering the AbuseFilter consequence while using DiscussionTools to edit
  • We should ensure that the siteverify API gets called once per request
    • It seems that currently this does not happen and multiple calls to HCaptcha::passCaptcha will make multiple calls to that API

Acceptance criteria

  • The siteverify API no longer returns already-seen-response for users using hCaptcha as expected (users who make two API requests with the same hCaptcha token are expected to still fail)

Event Timeline

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

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: cache siteverify result

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

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

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: refactor passCaptcha() function

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

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

[mediawiki/extensions/ConfirmEdit@master] HCaptcha: Add test for force show CAPTCHA mid request

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

Change #1286753 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: cache siteverify result

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

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

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: cache siteverify result

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

Change #1288512 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: cache siteverify result

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

Change #1287948 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] HCaptcha: Add test for force show CAPTCHA mid request

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

Change #1286807 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: refactor passCaptcha()

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