Page MenuHomePhabricator

Application Security Review Request : PlaceNewSection extension
Closed, ResolvedPublic

Description

Project Information

Description of the tool/project:
The PlaceNewSection extension introduces two magic words, __ADDNEWSECTIONBELOW__ and __ADDNEWSECTIONABOVE__, that control placement of new talk page sections.

Description of how the tool will be used at WMF:
In some projects, many discussion pages use adding topics at the top rather than at the bottom. This extension allows you to implement this behavior without using scripts or hacks.

Dependencies

List dependencies, or upstream projects that this project relies on.

	"require-dev": {
		"mediawiki/mediawiki-codesniffer": "41.0.0",
		"mediawiki/mediawiki-phan-config": "0.12.1",
		"mediawiki/minus-x": "1.1.1",
		"php-parallel-lint/php-console-highlighter": "1.0.0",
		"php-parallel-lint/php-parallel-lint": "1.3.2"
	},

Has this project been reviewed before?

Please link to tasks or wiki pages of previous reviews.

No previous reviews.

Working test environment

Please link or describe setup process for setting up a test environment.

  • Install extension.
  • Add __ADDNEWSECTIONABOVE__ (or __ADDNEWSECTIONBELOW__) on any talk page.
  • Start some topics with "Add topic" button.

Post-deployment

Name of team responsible for tool/project after deployment and primary contact.

I hope Editing-team I will ask review them.

Details

Risk Rating
Low

Event Timeline

@Iniquity - The Security-Team typically handles application security reviews on a quarterly cadence, and we've just set our reviews for this quarter. Also - is there a sponsoring team at the WMF to assist in the management of maintenance, security, etc. issues?

@Iniquity - The Security-Team typically handles application security reviews on a quarterly cadence, and we've just set our reviews for this quarter.

Thanks for the information! :) But suddenly you have time earlier, the extension is very small :)

Also - is there a sponsoring team at the WMF to assist in the management of maintenance, security, etc. issues?

@Ernstkm and, I hope, Editing team: T355164

@sbassett Hello! I see you have already created a pool of extensions for testing? Are we missing this quarter too? How long should we wait? Are there any criteria or something like that?
https://www.mediawiki.org/wiki/Wikimedia_Security_Team/Security_Review_Planning/2024-04-08

@sbassett Hello! I see you have already created a pool of extensions for testing? Are we missing this quarter too? How long should we wait? Are there any criteria or something like that?
https://www.mediawiki.org/wiki/Wikimedia_Security_Team/Security_Review_Planning/2024-04-08

Yes, unfortunately we had a few other reviews to accommodate at this time and due to our limited resources, this one wasn't able to be officially scheduled this quarter. Please also refer to our AppSec Review SOP: https://www.mediawiki.org/wiki/Security/SOP/Application_Security_Reviews#How_are_these_requests_prioritized?

@sbassett Hello! I see you have already created a pool of extensions for testing? Are we missing this quarter too? How long should we wait? Are there any criteria or something like that?
https://www.mediawiki.org/wiki/Wikimedia_Security_Team/Security_Review_Planning/2024-04-08

Yes, unfortunately we had a few other reviews to accommodate at this time and due to our limited resources, this one wasn't able to be officially scheduled this quarter. Please also refer to our AppSec Review SOP: https://www.mediawiki.org/wiki/Security/SOP/Application_Security_Reviews#How_are_these_requests_prioritized?

Is there any time frame for when this task will be taken on?

Is there any time frame for when this task will be taken on?

Not officially, no. As a team, we basically have a look at all requests that we've accumulated during a given quarter and then prioritize and distribute those across the limited resources Security Team AppSec has available for reviews each quarter. We try to accommodate every request as best we can, but sometimes there are re-prioritizations, delays, etc.

Is there any time frame for when this task will be taken on?

Not officially, no. As a team, we basically have a look at all requests that we've accumulated during a given quarter and then prioritize and distribute those across the limited resources Security Team AppSec has available for reviews each quarter. We try to accommodate every request as best we can, but sometimes there are re-prioritizations, delays, etc.

Do I understand correctly that with the current state of affairs, this request can be processed for several years? And is it easier for me to forget about this request and not plan any work for the coming years?

@Iniquity if you fill in the

Link to scc output for general sizing of codebases (https://github.com/boyter/scc):

part of the task description it might be easier for the security team to prioritize given just how *tiny* this extension really is (120 lines of PHP total and by my count 57 of those are comments and 14 are blank, so really 49 lines of PHP; no JavaScript)

@Iniquity if you fill in the

Link to scc output for general sizing of codebases (https://github.com/boyter/scc):

part of the task description it might be easier for the security team to prioritize given just how *tiny* this extension really is (120 lines of PHP total and by my count 57 of those are comments and 14 are blank, so really 49 lines of PHP; no JavaScript)

Thanks for the tip! I thought it would be more difficult to do than it turned out :)

Do I understand correctly that with the current state of affairs, this request can be processed for several years? And is it easier for me to forget about this request and not plan any work for the coming years?

Probably not several years, but it might have to wait a quarter or two, yes. Our manual security review process just isn't realistically scalable for the entirety of the MediaWiki/Wikimedia ecosystem. We hope to provide better and faster security analysis in the future via increased automation and better processes (like rapid risk assessments).

@sbassett Hi! Are you able to check the extension next quarter?

@sbassett Hi! Are you able to check the extension next quarter?

We'll be having our quarterly reviews planning meeting sometime either the first week (or early second week) of July, where we select reviews to complete for the upcoming quarter. We'll use the current prioritization process to select and prioritize security reviews. We have quite a few reviews within our upcoming planning and back orders columns, so it's going to be difficult to guarantee anything at this time.

Hello again! Another quarter has passed... What are your plans?

@ppelberg Can you help push this request, because as far as I understand, the security team absolutely does not want to work on something that is not supported by the WMF, but is requested by volunteers :( Or maybe @JWheeler-WMF can help, CWS request was here: https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2023/Notifications,_Watchlists_and_Talk_Pages/Allow_posting_new_sections_to_top_of_Talk_pages

I believe @acooper was attempting to find a WMF sponsor for this extension. At least that's where I believe we left things during our most recent quarterly planning session.

sbassett moved this task from Back Orders to Waiting on the secscrum board.

@acooper plans to follow up with various policy updates related to this request, this quarter (January 2025 - March 2025).

Hi, any progress here? 468 days or 5 quarters have passed.

Hi, any progress here? 468 days or 5 quaters left.

Unfortunately, no. @acooper was assigned this task, to determine some variety of policy approach for community-developed extensions. But he apparently did not do this and has since left the WMF. My hope is that we can revisit this issue once a replacement manager/director has been hired and within the context of policy being developed by the WMF's working group for code ownership and maintenance.

Jj881 renamed this task from Application Security Review Request : PlaceNewSection extension to Application Security Review Request :.Jun 3 2025, 1:51 AM
Jj881 triaged this task as Low priority.
JJMC89 renamed this task from Application Security Review Request : to Application Security Review Request : PlaceNewSection extension.Jun 3 2025, 2:07 AM
JJMC89 raised the priority of this task from Low to Needs Triage.
sbassett changed the task status from Open to In Progress.Jul 8 2025, 3:57 PM
sbassett assigned this task to mmartorana.
sbassett triaged this task as Medium priority.

We talked about this in some Editing team meetings a while ago, and at the time we felt that we didn't think there were any security issues with it, but we wouldn't want to deploy this to WMF wikis without making some changes to how it works. I don't know whether you'd like to put off formal security review until after anything like that happened...

We talked about this in some Editing team meetings a while ago, and at the time we felt that we didn't think there were any security issues with it, but we wouldn't want to deploy this to WMF wikis without making some changes to how it works. I don't know whether you'd like to put off formal security review until after anything like that happened...

I think we can review the extension as-is and determine any current security risks. This, of course, is not an implicit endorsement for production deployment, as many other qualifications will still need to be met. If the codebase is ever significantly refactored, I think we'd be happy to have another look at the code at that time.

mmartorana moved this task from In Progress to Our Part Is Done on the secscrum board.

Security Review Summary - T355161 - 2025-09-09
Last commit reviewed: 1a70f4d

Summary

This extension has a minimal attack surface: magic words are static, regex operations use MediaWiki's escaping functions, and no direct user input controls vulnerable code paths.

The theoretical regex injection and content injection risks are largely mitigated by MediaWiki's framework protections and the hardcoded nature of magic word definitions.

The overall risk rating is low.

Vulnerable Packages - Production
Risk: None

Vulnerable Packages - Development
Risk: None

As reported via composer outdated:
(no explicit vulnerabilities reported, simply noting for completeness' sake.)

PackageCurrentLatestDescription
composer/semver3.4.33.4.4Semver library that offers utilities, version constraint parsing and validation.
netresearch/jsonmapper4.5.05.0.0Map nested JSON structures onto PHP classes
phpcsstandards/phpcsextra1.2.11.4.0A collection of sniffs and standards for use with PHP_CodeSniffer.
phpcsstandards/phpcsutils1.0.121.1.1A suite of utility functions for use with PHP_CodeSniffer
sabre/event5.1.76.0.1sabre/event is a library for lightweight event-based programming
squizlabs/php_codesniffer3.12.23.13.2PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations o...

Static Analysis Findings
Risk: None
semgrep reported no issues low risk.
bearer reported no issues low risk.
sh-scan reported no issues low risk.
horusec reported no issues low risk.
snyk reported no issues low risk.
git-secrets reported no issues low risk.

General Security Issues (XSS, S/CSRF, SQLi, Ci, Cjack, etc.)
Risk: None