forked from pypi/warehouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: admin flag to require 2fa (pypi#15017)
- Loading branch information
1 parent
7ce1a6e
commit f695f5a
Showing
5 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: 2FA Enforcement for TestPyPI | ||
description: PyPI requires 2FA for all management actions on TestPyPI. | ||
author: Mike Fiedler | ||
publish_date: 2023-12-06 | ||
date: "2023-12-06 00:00" | ||
tags: | ||
- 2fa | ||
- security | ||
--- | ||
|
||
## What's changing? | ||
|
||
Starting today, **all users must enable 2FA** | ||
before they can perform any management actions on [TestPyPI](https://test.pypi.org/). | ||
|
||
This change is in preparation for the | ||
[scheduled enforcement of 2FA on PyPI](2023-05-25-securing-pypi-with-2fa.md) | ||
at the end of 2023. | ||
|
||
Previously the PyPI team has announced | ||
[2FA requirement for uploads](2023-06-01-2fa-enforcement-for-upload.md), | ||
[2FA requirement for new user registrations on PyPI](2023-08-08-2fa-enforcement-for-new-users.md), | ||
and now the requirement extends that **all users** on TestPyPI. | ||
|
||
## How does this affect me? | ||
|
||
If you only need to browse, download, and install packages from TestPyPI | ||
then a TestPyPI account isn't needed so this change does not affect you. | ||
|
||
If you've already enabled 2FA on your TestPyPI account, | ||
this change will not affect you. | ||
|
||
If you recently registered a new TestPyPI account, | ||
you are required to enable 2FA before you can perform any management actions. | ||
When attempting to perform a management action, | ||
you may see a red banner flash at the top of the page, | ||
and be redirected to the 2FA setup page for your account. | ||
You will still be able to log in, browse, and download packages without 2FA. | ||
But to perform any management actions, you'll need to enable 2FA. | ||
|
||
Visit [the 2FA FAQ](https://pypi.org/help/#twofa) for more details. | ||
|
||
_Mike Fiedler is the PyPI Safety & Security Engineer since 2023._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
warehouse/migrations/versions/0940ed80e40a_admin_flag_2fa_required.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
Admin Flag: 2fa-required | ||
Revision ID: 0940ed80e40a | ||
Revises: 4297620f7b41 | ||
Create Date: 2023-12-05 23:44:58.113194 | ||
""" | ||
|
||
from alembic import op | ||
|
||
revision = "0940ed80e40a" | ||
down_revision = "4297620f7b41" | ||
|
||
|
||
def upgrade(): | ||
op.execute( | ||
""" | ||
INSERT INTO admin_flags(id, description, enabled, notify) | ||
VALUES ( | ||
'2fa-required', | ||
'Require 2FA for all users', | ||
FALSE, | ||
FALSE | ||
) | ||
""" | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.execute("DELETE FROM admin_flags WHERE id = '2fa-required'") |