Commit graph

4 commits

Author SHA1 Message Date
Fomafix
6d61b366a2 Support message parameters on the uselang=x-xss feature
This allows to check also message parameters for possible JavaScript
injections.

Bug: T340201
Change-Id: I6bef28cd9c6b91713b66b40cba46e9b2dc2a1f05
2023-09-28 15:33:00 +00:00
Lucas Werkmeister
e9991ffb68 Create 'x-xss' language code feature
This creates a new language code, 'x-xss', which is enabled using the
setting $wgUseXssLanguage (similar to how $wgUsePigLatinVariant enables
the 'en-x-piglatin' language code, and likewise defaults to false; will
be enabled in development settings soon).

In this language code, all messages become “malicious”, trying to run
some alert() JavaScript; if any alert() actually fires in the browser,
the message was not escaped properly. ($wgRawHtmlMessages are exempt,
since they’re already known to be “unsafe” and require more rights to
edit on-wiki.) Messages that are not escaped properly are generally a
minor security issue; they effectively let a user with 'editinterface'
right (such as a sysop, on many wikis) run arbitrary JS, without needing
the 'editsitejs' right (normally restricted to interface admins).

Developers can use this language code to more easily check their code
for escaping issues / cross-site scripting vulnerabilities.

Bug: T340201
Change-Id: Ia9a1cf712b139fea5da72046e37035e6de39d8d5
2023-09-28 15:50:11 +02:00
Amir Sarabadani
cd2e19c050 tests: Use $this->getDb() instead of wfGetDB() in integration tests
Deprecated long time ago.

Bug: T330641
Change-Id: Ia57f12d350c3346029aafae25534c9ed262a7e98
2023-09-25 21:08:09 +02:00
Lucas Werkmeister
7b8859c70c language: Move tests from /cache to /language
The classes were already moved in change I62c701d574 (commit
051e127bdb).

Ideally, the tests should have a namespace, but the other tests in
/language are also unnamespaced, so let’s not do that yet.

Change-Id: Ieef8728a1f474ce6b16fa534c9697e1e89a4a36d
2023-07-28 15:23:06 +02:00
Renamed from tests/phpunit/includes/cache/MessageCacheTest.php (Browse further)