Page MenuHomePhabricator

Implement a reverse proxy for gitlab.wikimedia.org raw content that supports mime-type specification
Closed, ResolvedPublicFeature

Description

As a technical contributor
I want to load javascript and css content hosted on gitlab.wikimedia.org in userscripts and/or gadgets on Wikimedia wikis
So I can implement collaborative workflows using git and CI.

GitLab serves raw content with Content-Type: text/plain and X-Content-Type-Options: nosniff headers which prevents us from trivially linking to content hosted on the service. These are reasonable protections from various forms of MIME confusion and XSS attacks. The upstream has rejected requests for integrated raw content delivery on multiple occasions.

Use of a reverse proxy separates sessions that visitors may have on the gitlab.wm.o site from the delivery of content by the Toolforge tool diffusing XSS attacks against the gitlab site. This can be seen as operating similarly to gitlab pages by delivering the content from a separate domain.

Related: T321458: Allow Javascript files from Wikimedia GitLab to be loaded as scripts in Wikimedia wikis

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Do the proxy thingstoolforge-repos/gitlab-content!2bd808work/bd808/do-the-thingmain
Customize query in GitLab

Event Timeline

bd808 triaged this task as Medium priority.

I plan to work on a implementation for this idea during the Wikimedia-Hackathon-2025.

https://gitlab.wikimedia.org/toolforge-repos/prototyper-proxy/-/blob/c6f29129b3208fb1903f495a12d08063f2a6ddef/index.php is a narrowly focused service that I built a few months ago as part of another hackathon event. I am aware of the prior discussions in T321458: Allow Javascript files from Wikimedia GitLab to be loaded as scripts in Wikimedia wikis and believe that the primary reason for declining that task was that implementation within gitlab.wikimedia.org itself would be problematic for various reasons.

bd808 changed the task status from Open to In Progress.May 3 2025, 2:45 PM
bd808 removed a project: Epic.

I don't remember if this was shown at the Hackathon showcase, but it would be great if we added it to the Tech News.

https://gitlab-content.toolforge.org/

I don't remember if this was shown at the Hackathon showcase, but it would be great if we added it to the Tech News.

https://gitlab-content.toolforge.org/

It didn't make it into the showcase due to time constraints. I have a task to do some more documentation at T393330: Add maintainer docs and user usage instructions to wikitech:Tool:Gitlab-content and am planning on a wikitech-l email to go along with that. Let's see if I can do all that in time for the next Tech News. :)

Hello @bd808, for tech news - What wording would you suggest as the content, and When should it be included? Thanks!

Hello @bd808, for tech news - What wording would you suggest as the content, and When should it be included? Thanks!

Maybe something like this? It can run whenever y'all are happy with the prose. It is probably too late to get it into the 2025-05-12 issue, but the following week will be fine.

Userscript developers can use a new reverse proxy tool to load javascript and css from gitlab.wikimedia.org with mw.loader.load. The tool's author hopes this will enable collaborative development workflows for userscripts including linting, unit tests, code generation, and code review on gitlab.wikimedia.org without a separate copy-and-paste step to publish scripts to a Wikimedia wiki for integration and acceptance testing. See https://wikitech.wikimedia.org/wiki/Tool:Gitlab-content for more information.

Hello @bd808, for tech news - What wording would you suggest as the content, and When should it be included? Thanks!

Maybe something like this? It can run whenever y'all are happy with the prose. It is probably too late to get it into the 2025-05-12 issue, but the following week will be fine.

Userscript developers can use a new reverse proxy tool to load javascript and css from gitlab.wikimedia.org with mw.loader.load. The tool's author hopes this will enable collaborative development workflows for userscripts including linting, unit tests, code generation, and code review on gitlab.wikimedia.org without a separate copy-and-paste step to publish scripts to a Wikimedia wiki for integration and acceptance testing. See https://wikitech.wikimedia.org/wiki/Tool:Gitlab-content for more information.

I added this wording at https://meta.wikimedia.org/w/index.php?title=Tech/News/2025/21&diff=prev&oldid=28740345. Edits welcome there before things get locked down for translation.