Page MenuHomePhabricator

hCaptcha risk scores: New API endpoint for collecting risk scores
Closed, ResolvedPublic1.5 Estimated Story Points

Description

Summary

Add a new API endpoint to ConfirmEdit that:

  1. Receives an hCaptcha token and block ID from the client
  2. Verifies the token via HCaptcha::passCaptcha()
  3. Retrieves the risk score via HCaptcha::retrieveSessionScore(), and
  4. Fires a hook handled by MediaWiki-extensions-WikimediaEvents to record the score.

Acceptance Criteria

  • A new endpoint is registered under ConfirmEdit that will retrieve the risk score
  • The endpoint receives two required parameters riskScoreToken and blockIds
  • The new endpoint uses the existing functionality in the HCaptcha class to verify the token (the class may need to be refactored to support that)
  • The endpoint then fires a hook carrying the risk score, so that it can be consumed by MediaWiki-extensions-WikimediaEvents to record the score.

Event Timeline

• hector.arroyo renamed this task from hCaptcha: New API endpoint for collecting risk scores to hCaptcha risk scores: New API endpoint for collecting risk scores.May 12 2026, 2:15 PM

Change #1289304 had a related patch set uploaded (by Harroyo-wmf; author: Harroyo-wmf):

[mediawiki/extensions/ConfirmEdit@master] WiP

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

Change #1289304 abandoned by Harroyo-wmf:

[mediawiki/extensions/ConfirmEdit@master] WiP

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

Change #1290031 had a related patch set uploaded (by Harroyo-wmf; author: Harroyo-wmf):

[mediawiki/extensions/ConfirmEdit@master] WiP

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

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

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: Hide risk-score REST route when hCaptcha is not enabled

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

Change #1290031 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: Endpoint for collecting risk scores

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

Change #1295993 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: Register risk-score REST route in the hCaptcha extension

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

What about QA?

I was assuming that QA would test the whole feature end-to-end instead of testing individual tickets.

What about QA?

I was assuming that QA would test the whole feature end-to-end instead of testing individual tickets.

Given this part is going out this week, I'd rather the engineers at least check the data is being collected as expected even if a more full QA is done elsewhere?

• hector.arroyo changed the task status from Open to In Progress.Jun 2 2026, 1:44 PM
dom_walden subscribed.

I have done a certain amount of testing of this. More will be done after T428394.