Page MenuHomePhabricator

hCaptcha: log risk score of null edits with other action than `edit`
Closed, ResolvedPublic

Description

Summary

The CaptchaScoreHooks hook is logging hCaptcha risk scores for null edits with the same action type as regular edits. Null edits don't change page content, so they should be distinguished from actual edits.

Technical notes

  • The CaptchaScoreHooks::onPageSaveComplete method in includes/EditPage/CaptchaScoreHooks.php receives the $editResult parameter but doesn't check $editResult->isNullEdit() before logging risk scores. We can adjust the logic to use the proper action to log the score nonetheless.

Acceptance criteria

  • CaptchaScoreHooks::onPageSaveComplete checks $editResult->isNullEdit() and sets the action to "null_edit" instead of CaptchaTriggers::EDIT when it's a null edit

Event Timeline

sguebo_WMF changed the task status from Open to In Progress.Nov 20 2025, 12:11 AM
sguebo_WMF triaged this task as Medium priority.

Change #1207301 had a related patch set uploaded (by Samuel (WMF); author: Samuel (WMF)):

[mediawiki/extensions/WikimediaEvents@master] hCaptcha: log risk score for null edits

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

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

[mediawiki/extensions/WikimediaEvents@wmf/1.46.0-wmf.3] hCaptcha: Log the risk score for null edits differently

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

Change #1207788 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@wmf/1.46.0-wmf.3] hCaptcha: Log the risk score for null edits differently

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

Change #1207301 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] hCaptcha: Log the risk score for null edits differently

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

Mentioned in SAL (#wikimedia-operations) [2025-11-20T08:36:22Z] <kharlan@deploy2002> Started scap sync-world: Backport for [[gerrit:1207788|hCaptcha: Log the risk score for null edits differently (T410550)]]

Mentioned in SAL (#wikimedia-operations) [2025-11-20T08:40:50Z] <kharlan@deploy2002> kharlan: Backport for [[gerrit:1207788|hCaptcha: Log the risk score for null edits differently (T410550)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-11-20T08:47:13Z] <kharlan@deploy2002> Finished scap sync-world: Backport for [[gerrit:1207788|hCaptcha: Log the risk score for null edits differently (T410550)]] (duration: 10m 51s)