Page MenuHomePhabricator

[Regression] PHP files in /static (and /w/static) on text domains should not execute
Closed, ResolvedPublic

Description

https://en.wikipedia.org/static/current/resources/Resources.php
https://en.wikipedia.org/w/static/current/resources/Resources.php
https://en.wikipedia.org/w/resources/Resources.php

Not an entry point.

Which indicates PHP code did execute.

https://en.wikipedia.org/static/current/extensions/VisualEditor/includes/VisualEditorDataModule.php
https://en.wikipedia.org/w/static/current/extensions/VisualEditor/includes/VisualEditorDataModule.php

PHP fatal error:
unknown class ResourceLoaderModule

The /w/extensions directory has php-engine flag Off. And bits.wikimedia.org used to as well. But this new /static and /w/static do not have that setting.

Event Timeline

Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle changed the visibility from "Public (No Login Required)" to "WMF-NDA (Project)".
Krinkle changed the edit policy from "All Users" to "WMF-NDA (Project)".
Krinkle added subscribers: Krinkle, mmodell, ori.

Does this get set via .htaccess? I'm not sure how to go about fixing this.

May be related to this:
https://github.com/wikimedia/operations-puppet/blob/9ce8cafd06382c58008045f1cf30a35c1f29051c/modules/mediawiki/files/apache/beta/sites/remnant.conf#L12
https://github.com/wikimedia/operations-puppet/blob/b594142c040b5a239604871186ae6bbea7c45830/modules/mediawiki/files/apache/sites/wikimedia-common.incl#L8

<IfDefine HHVM>
    ProxyPass       /wiki                fcgi://127.0.0.1:9000/srv/mediawiki/docroot/commons/w/index.php retry=0
    ProxyPass       /w/extensions        !
    ProxyPassMatch  ^/w/(.*\.(php|hh))$  fcgi://127.0.0.1:9000/srv/mediawiki/docroot/commons/w/$1

Before migration to HHVM, we used to specify Directory w/extensions php-engine flag Off somewhere in apache config.

Krinkle set Security to None.
Krinkle updated the task description. (Show Details)
Krinkle renamed this task from The /static (and /w/static) directories no longer set php-engine=Off to [Regression] PHP files in /static (and /w/static) on text domains should not execute.Feb 5 2016, 5:07 PM
Krinkle triaged this task as High priority.

This is probably caused by puppet:///modules/mediawiki/files/apache/configs/hhvm_catchall.conf

<IfDefine HHVM>
    <FilesMatch "\.(php|hh)$">
        RewriteRule ^(.*)$ fcgi://127.0.0.1:9000$1 [P]
    </FilesMatch>
</IfDefine>
Krinkle updated the task description. (Show Details)

I think this would be fixed by specifying better the catchall.

BBlack subscribed.

The swap of Traffic for Traffic-Icebox in this ticket's set of tags was based on a bulk action for all such tickets that haven't been updated in 6 months or more. This does not imply any human judgement about the validity or importance of the task, and is simply the first step in a larger task cleanup effort. Further manual triage and/or requests for updates will happen this month for all such tickets. For more detail, have a look at the extended explanation on the main page of Traffic-Icebox . Thank you!

Hi, @Krinkle! This is a really old bug so I'm sorry if you cannot remember, but do you know if this is still an issue? These links are giving me 404s, which gives me the impression that this has been fixed (either incidentally with the myriad changes in the past decade or by your patch which was merged).

BCornwall claimed this task.

Setting as resolved for the reasons detailed above. If this is in error, please feel free to re-open! Thanks for the work on this ticket. :)

Thanks @BCornwall. This is indeed resolved. The paths did change a bit so in this case the (expected) 404 Not Found is not (only) because the problem was solved meanwhile.

The fix for this issue happened as part of T302465. Specifically we added a rewrite rule for a new /w/{skins,resources,extensions}/* route that proxies through /w/static.php, which only serves files statically, never executing anything. The /static/current/* URLs, which unlike the name suggested were not static, were deprecated in favour of the new /w/* URLs. Once all usage was updated, we removed support for those /static/current/ URLs by removing the symlink that exposed those directories from the docroot in https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/779944/.

Krinkle changed the visibility from "WMF-NDA (Project)" to "Public (No Login Required)".Apr 12 2023, 6:22 AM
Krinkle changed the edit policy from "WMF-NDA (Project)" to "All Users".