Wikimedia Security Team/SDLC

= Security in the WMF SDLC = Security and Privacy should be integrated throughout the software development process at the WMF. There are several points in the process where the Security Team must be involved, and developer training raises awareness for developers and product managers to make good security decisions.

When specifically looking at WMF product development process, which defines a, Concept > Plan > Design > Build > Release > Maintain cycle, it's anticipated teams should consider security in the follow phases.

Concept
Teams should consider, and possibly document,
 * Does this feature make sense from a security perspective?

If it's likely the project will need security reviews by the Security Team, coordinate with the Security Team to schedule.

Plan / Design
When designing the architecture for your project, security and privacy should be considered throughout the process.

Often, during the design phase your team can make certain design decisions to limit the ways your application can be attacked (minimizing the attack surface) or limiting the harm that can be done if your project is compromised. You may consider,
 * Can a service or tool run on Labs hardware, so a complete compromise of the underlying system as a result of this tool will be limited to an untrusted labs instance?
 * Can this service or tool run on an untrusted domain, to limit the impact of a cross-site scripting vulnerability?
 * Can the functionality be limited to a small set of trusted users?

For privacy assessment planning, you will need to document what types of data your project will collect, how it will be used within your project, how it will be transferred, where it will be stored, who will have access to it, and if any third-parties will be involved. If your project is likely to significantly impact user privacy, a Privacy Impact Analysis will need to be completed.

For both security and privacy, you should document a data-flow diagram of your project. This should list, From this diagram, the Security Team can highlight the anticipated security controls that will need to be implemented by your project before it is released into production.
 * The different users of your product or feature
 * The major, anticipated components that users will interact with (special pages, API modules, parser functions, service endpoints)
 * Any external services, applications, or scripts that your components will interact with
 * Where your data will be stored

Once your team has documented the privacy impact and data flows, the Security Team can perform a design review. These typically can be completed in a 60 minute meeting with a Security Team member.

Build
As your team develops code for your project, they should integrate security into their process.

All members writing or reviewing code should attend a Secure Coding training, giving regularly by the Security Team. If developers cannot attend the training when it is given, they can also review Security for developers and watch [http://#|a recorded training session].

All code committed into your project should be reviewed by a second developers. Reviewers should check for security issues as part of their review, as outlined in the MediaWiki code review guidelines.

Frequently, your team will make use of other open source libraries within the project. When choose a library, prefer libraries supported by an organization with a dedicated security team who responds to security issues and have a track-record of releasing security updates in a timely manner. If the library is being added to MediaWiki's vendor repository, the library should be designed and documented in a way that makes correct use easy. Your team is responsible for appointing someone to ensure that the version of the library included with your project is kept up to date with all security patches.

Your project should have browser tests that document and exercise all interfaces into your code. The Security Team will use your browser tests to seed our security scanning.

Release
Except in rare cases, all new services, extensions, and major new features need a security review by a member of the Security Team, or a trusted delegate, before it can be deployed on any WMF sites.

Due to limited capacity on the Security Team, these reviews should be scheduled before the start of the quarter.

Maintenance
While your project is in production, your team is responsible for fixing any security issues that are reported in the code. Issues will be reported and tracked in Phabricator. Priority will be set by the security team according to our prioritization guidelines. Your team should develop security patches in accordance with our patch development process for security issues. If your project is released as part of the MediaWiki tarball, your team should collaborate with Release Engineering to release patches and make the issue public.