WordPress / wporg-two-factor

2FA for WordPress.org accounts
37 stars 8 forks source link

Enforce 2FA for privileged accounts #6

Open iandunn opened 2 years ago

iandunn commented 2 years ago

Core/Meta committers, super-admins, project leaders, committers to plugins w/ > 50k active installs, etc should be required to use 2FA of some kind. How strict we are should depend on what kind of access they have.

Related:

iandunn commented 2 years ago

Related: wpcom_vip_two_factor_filter_caps() from https://github.com/Automattic/vip-go-mu-plugins/blob/develop/two-factor.php

iandunn commented 2 years ago

Rough idea:

Requiring a hardware key for the highest privilege group would prevent phishing. Most folks will never buy one though, so it’s important to not push it too hard. Maybe we give frequent contributors a coupon code so they can buy one on mercantile.w.org for the cost of shipping, or half price or something.

iandunn commented 1 year ago

To facilitate this, we may want to reorganize capes.php, so it has a group of functions like get_core_committers(), get_meta_committers(), get_wordcamp_deputies(), etc. They'd return an array of usernames, and could be used for the existing watch/supes logic. They could also be used by this plugin to define who needs to have 2FA enabled.

iandunn commented 1 year ago

The upstream PR needs a good amount of work IMO, so in this case it might be better if we build those parts here for the MVP, and contribute them upstream later. So this would do 3 things:

  1. Check if the logged in user needs to enable 2FA
  2. Remove their capabilities. This is necessary even though we'll redirect them, because otherwise they could still perform privileged actions on the front end, via the REST API, etc
  3. Redirect them to the (front-end) page where they can enable it. The URL of that is still TBD, so we could just use the wp-admin profile for now, and update it once it exists.
tellyworth commented 1 year ago

Some of this belongs in later iterations IMO. Some of the underlying code probably needs to be in place (eg to avoid bypassing 2FA for accounts that have already enabled it), but 100% opt-in should be fine for the initial MVP release.

iandunn commented 1 year ago

πŸ‘πŸ» I disabled the 2FA requirement in production environments in d00ba1b, and moved this issue to the Iteration 1 milestone.

Some of the underlying code probably needs to be in place (eg to avoid bypassing 2FA for accounts that have already enabled it)

d00ba1b made 2FA opt-in, but shouldn't prevent anyone from setting it up, or using it once it's enabled.