Closes a critical security hole in the action=editwarning API (missing CSRF/authentication checks
and two independent XSS vectors) and drops support for MediaWiki 1.35.
Breaking Changes
action=editwarningAPI requests must now be POSTed with acsrftoken, and no longer accept a
userparameter; the lock is always attributed to the authenticated session user
(ApiBase::getUser()), never to an arbitrary request parameter. Anonymous requests are rejected.
resources/js/editwarning.jswas updated to usemw.Api().postWithToken('csrf', ...)accordingly.
17a058a- Dropped support for MediaWiki 1.35; the minimum supported version is now 1.39.
extension.jsonnow
declaresrequires.MediaWiki >= 1.39.0and usesmanifest_version2.
5f4155a
Fixed
- Fixed
EditWarningApiperforming database writes (lock/unlock) without CSRF protection or
authentication: it never overrodeneedsToken()/mustBePosted()/isWriteMode(), and determined the
acting user from auserrequest parameter instead of the authenticated session, allowing any page to
lock or unlock articles on behalf of any user via a simple cross-site GET request.
17a058a - Fixed
EditWarningMessage::addLabel()/addLabelMsg()substituting arbitrary values (e.g. a cancel URL
built from a page title, which MediaWiki's default$wgLegalTitleCharsallows to contain") directly
into HTML templates without escaping, allowing HTML attribute-breakout/script injection via a crafted
page title; values are now escaped withhtmlspecialchars()when added.
17a058a - Fixed
EditWarningMessage::processTemplate()usingpreg_replace()to substitute label values, which
interprets sequences like$1or\0in the replacement as backreferences instead of literal text;
switched topreg_replace_callback()so label values are always substituted literally.
17a058a - Fixed
EditWarningApilocking/unlocking a section always storing/removing the lock as section0
(whole-article) because thesectionrequest parameter, despite being passed toEditWarning::setSection(),
was never forwarded tosaveLock()/removeLock(); the API'ssectionparameter now has an effect.
9c7fcbe - Fixed
EditWarningApiechoingarticleidback as a string instead of the declared integer type by using
extractRequestParams()instead of rawgetVal()calls.
9c7fcbe - Fixed
EditWarningMessage::setMsg()interpolating message parameters (username, timestamps, cancel URL)
into the rendered warning/notice HTML without escaping, allowing HTML/script injection via a crafted
username; parameters are now escaped withhtmlspecialchars()before substitution.
9c7fcbe - Fixed
EditWarningMessage::loadTemplate()catching template read failures but re-throwing the base
\Exceptionclass directly instead of a proper SPL exception; bothloadTemplate()and
processTemplate()now throw\RuntimeException.
9c7fcbe - Fixed
composer updatefailing in CI with aPluginBlockedExceptionby allow-listing the
dealerdirect/phpcodesniffer-composer-installerComposer plugin.
9492d9c - Fixed
EditWarning::addLock()classifying locks by the inverse of their actual type: rows with
section = 0(whole-article locks) were treated as section locks and vice versa, so
isArticleLocked()/isSectionLocked()and friends never reflected the real lock state.
49a93d4 - Fixed a dynamic-property mismatch in
EditWarningLockwhere the declared$timestampproperty was
never read from or written to;getTimestamp()/setTimestamp()used$_timestampinstead, silently
creating an undeclared dynamic property on every lock object.
49a93d4 - Fixed
EditWarningMsg::getInstance()caching the first rendered message per type (e.g. "ArticleWarning")
for the lifetime of the PHP worker process, leaking one user's name/timestamp/cancel URL into every
other user's warning message of the same type until the worker restarted.
49a93d4 - Fixed coverage.xml path used for the Codecov upload in CI.
8e10d19 - Fixed generated documentation to include the MediaWiki AGENTS document template in AGENTS-source.
af31948
Added
- Added
codecov.ymland enabled Codecov coverage upload in CI for the MediaWiki 1.43 test job; added a
Codecov badge to the README.
8b04f86 - Added an integration test for
EditWarningHooks::logout(), the only database-touching hook path that
previously had no test coverage.
49a93d4 - Added unit and integration tests for
EditWarningLock,EditWarning,EditWarningMessage, the
EditWarningCancelMsg/EditWarningInfoMsg/EditWarningWarnMsgsubclasses, and all decision branches
ofEditWarningHooks::edit()(new/updated/conflicting article and section locks, anonymous users,
PageForms'action=formedit), raising line coverage from ~32% to ~84%.
49a93d4 - Added Phan static analysis (
.phan/config.php,.phan/baseline.php,composer phan,
make composer-phan/composer-phan-update-baseline), run in CI for the MediaWiki 1.43/coverage job.
e74cc44 - Added CHANGELOG.md, following Keep a Changelog.
fe1c049
Changed
- Replaced deprecated
wfGetDB()/DB_MASTERcalls with
MediaWikiServices::getDBLoadBalancer()->getConnection( DB_REPLICA/DB_PRIMARY )inEditWarningHooks
andEditWarningApi.
1534651 - Raised the minimum required PHP version to 8.1 in
composer.json, in line with dropping MediaWiki
1.35/PHP 7.4.
5f4155a - Local
make install/make cinow default to MySQL instead of SQLite, matching the CI matrix.
245f67a EditWarningMsg::getInstance()no longer caches message instances as a per-type singleton; it now
builds a fresh instance on every call.
49a93d4- CI now installs gesinn.it's PageForms fork (
gesinn-it/mediawiki-extensions-PageForms, pinned to
2.1.9) as a test dependency, configurable via thePF_REPO/PF_VERSIONMakefile variables, to
verify compatibility with PageForms-driven (action=formedit) edits.
dd9c51a - Updated CI runner image and action versions.
c9e3d42