User:SBassett (WMF)/Security Review Howto Extensions

The documentation below describes some of the typical steps followed by members of the Wikimedia Security Team when security-reviewing mediawiki extensions. Note that this page does not necessarily list every step followed by every engineer, nor does it go into extensive detail for each step. The hope is that this page becomes a set of general guidelines and best practices for security-reviewing mediawiki extensions.

Initial Items to Confirm
Have the requestors:
 * 1) followed the security review process?  Specifically, have they filled out a security review request within phabricator?
 * 2) confirmed that there is an actual plan for the extension to be deployed to production (rfc, quarterly goal, sre/ops buy-in, beta-testing, scheduled launch date, etc.)?
 * 3) provided an adequate explanation of what the extension does?  e.g. a   or Mediawiki documentation page?
 * 4) provided a working development environment with appropriate instructions (vagrant role, docker, installation notes, etc.)?
 * 5) followed the basic Mediawiki security guidelines for developing code?

Basic and Automated Checks
Several basic and/or automated checks can be performed against extension codebases during a security review. These include:
 * 1) Building out the extension within a local test environment to analyze its functionality from a user's perspective.
 * 2) Reviewing and running any associated unit/integration tests (phpunit, qunit) for a better understanding of how the extension works and critical code paths.
 * 3) Testing portions of the code via shell.php or similar tools.

In-Depth Analysis
Most extensions will require at least some form of more detailed, manual analysis of the code. This includes: