Page MenuHomePhabricator

hCaptcha: Self-host secure-api.js code
Open, Stalled, Needs TriagePublic

Description

Summary

The contents of secure-api.js can be self-hosted. We should consider doing this for improved auditability, especially if/when the contents change.

Specification

secure-api.js should be loaded from a versioned repository. The endpoint, assethost, and other query parameters should continue to be set to values that use the proxy.

Technical notes

TBD

Acceptance criteria

  • secure-api.js is stored in a publicly versioned repository
  • secure-api.js is loaded directly or indirectly via the publicly versioned repository
  • After loading our self-hosted secure-api.js, requests to hCaptcha from the client continue to route through the proxy

Event Timeline

To be clear, the main goal here is to remove the risk of unexpected changes (including compromise) of the part of the JavaScript that necessarily has access to the parent document context before establishing the iframes that the rest of the code is then loaded into.

We should consider doing this for improved auditability, especially if/when the contents change.

The auditability benefit here is when compared to the other ways we might address this risk (inlining the JS inside our other existing files, or using Subresource Integrity to protect the code from a 3P origin).

kostajh updated the task description. (Show Details)

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

[mediawiki/extensions/ConfirmEdit@master] WIP: Use ResourceLoader for secure-api.js

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

For licensing reasons, as discussed in 1185314 (and to my knowledge as well), we are unable to host any proprietary code to our repos. I am afraid, same principle applies to our puppet repo as well.

Change #1185314 abandoned by Kosta Harlan:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha: Use ResourceLoader for locally-hosted secure-api.js

Reason:

Abandoning this for now

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

kostajh changed the task status from Open to Stalled.Sep 25 2025, 1:41 PM
kostajh removed kostajh as the assignee of this task.