Skip to content

Commit 202ab85

Browse files
authored
PEP 458: Consistency & clarification edit (#1284)
* Made various edits and clarifications to the pep including: * letting the PSF appoint offline key holders * moving content from abstract to motivation to make the abstract more succinct * updating the threat model * resolving some minor inconsistencies * add link to cncf blog post
1 parent 17710b8 commit 202ab85

File tree

1 file changed

+51
-47
lines changed

1 file changed

+51
-47
lines changed

pep-0458.txt

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,6 @@ Post-History: 06-Jan-2019
2323
Abstract
2424
========
2525

26-
Attacks on software repositories are common, even in organizations with very
27-
good security practices__. The resulting repository compromise allows an
28-
attacker to edit all files stored on the repository and sign these files using
29-
any keys stored on the repository (online keys). In many signing schemes (like
30-
TLS), this access allows the attacker to replace files on the repository and
31-
make it look like these files are coming from PyPI. Without a way to revoke and
32-
replace the trusted private key, it is very challenging to recover from a
33-
repository compromise. In addition to the dangers of repository compromise,
34-
software repositories are vulnerable to an attacker on the network (MITM)
35-
intercepting and changing files. These and other attacks on software
36-
repositories are detailed here__. This PEP aims to protect users of PyPI from
37-
compromises of the integrity, consistency and freshness properties of PyPI
38-
packages, and enhances compromise resilience, by mitigating key risk and
39-
providing mechanisms to recover from a compromise of PyPI or its signing keys.
40-
In addition to protecting direct users of PyPI, this PEP aims to provide similar
41-
protection for users of PyPI mirrors.
42-
43-
To provide compromise resilient protection of PyPI, this PEP proposes the use of
44-
The Update Framework [2]_ (TUF). TUF provides protection from a variety of
45-
attacks on software update systems, while also providing mechanisms to recover
46-
from a repository compromise. TUF has been used in production by a number of
47-
organizations, including use in Cloud Native Computing Foundation’s Notary
48-
service, which provides the infrastructure for container image signing in Docker
49-
Registry. The TUF specification has been the subject of three independent
50-
security audits__.
51-
5226
This PEP describes changes to the PyPI infrastructure that are needed to ensure
5327
that users get valid packages from PyPI. These changes should have minimal
5428
impact on other parts of the ecosystem. The PEP focuses on communication between
@@ -62,15 +36,12 @@ mechanism. There is documentation for how to consume TUF metadata in the TUF
6236
repository. However, changes to PyPI consumers are not required, and can be done
6337
according to the timelines and priorities of individual projects.
6438

65-
__ https://github.com/theupdateframework/pip/wiki/Attacks-on-software-repositories
66-
__ https://theupdateframework.github.io/security.html
67-
__ https://theupdateframework.github.io/audits.html
6839

6940

7041
Proposed TUF Integration
7142
========================
7243

73-
This PEP proposes how The Update Framework [2]_ (TUF) should be integrated with the
44+
This PEP proposes how The Update Framework [2]_ (TUF__) should be integrated with the
7445
Python Package Index (PyPI [1]_). TUF was designed to be a flexible
7546
security add-on to a software updater or package manager. The framework
7647
integrates best security practices, such as separating role responsibilities,
@@ -82,8 +53,10 @@ files. Or, alternatively, a role
8253
responsible for indicating the latest snapshot of the repository may also have to be
8354
compromised.
8455

56+
__ https://www.linuxfoundation.org/cloud-containers-virtualization/2017/10/cncf-host-two-security-projects-notary-tuf-specification/
57+
8558
The proposed integration will allow modern package managers, such as pip [3]_ to
86-
be more secure against security attacks on PyPI, and to better protect
59+
be more secure against attacks on PyPI, and to better protect
8760
users from such attacks. Specifically, this PEP describes how PyPI processes
8861
should be adapted to generate and incorporate TUF metadata (i.e., the minimum
8962
security model). The minimum security model supports verification of PyPI
@@ -123,12 +96,34 @@ PEP Status
12396
Due to the amount of work required to implement this PEP, in early
12497
2019 it was deferred until appropriate funding could be secured to
12598
implement the PEP. The Python Software Foundation secured this funding
126-
[22]_ and new PEP coauthors restarted PEP discussion.
99+
[22]_ and new PEP coauthors restarted PEP discussion__.
100+
101+
__ https://discuss.python.org/t/pep-458-secure-pypi-downloads-with-package-signing/2648/
127102

128103

129104
Motivation
130105
==========
131106

107+
Attacks on software repositories are common, even in organizations with very
108+
good security practices__. The resulting repository compromise allows an
109+
attacker to edit all files stored on the repository and sign these files using
110+
any keys stored on the repository (online keys). In many signing schemes (like
111+
TLS), this access allows the attacker to replace files on the repository and
112+
make it look like these files are coming from PyPI. Without a way to revoke and
113+
replace the trusted private key, it is very challenging to recover from a
114+
repository compromise. In addition to the dangers of repository compromise,
115+
software repositories are vulnerable to an attacker on the network (MITM)
116+
intercepting and changing files. These and other attacks on software
117+
repositories are detailed here__. This PEP aims to protect users of PyPI from
118+
compromises of the integrity, consistency, and freshness properties of PyPI
119+
packages, and enhances compromise resilience by mitigating key risk and
120+
providing mechanisms to recover from a compromise of PyPI or its signing keys.
121+
In addition to protecting direct users of PyPI, this PEP aims to provide similar
122+
protection for users of PyPI mirrors.
123+
124+
__ https://github.com/theupdateframework/pip/wiki/Attacks-on-software-repositories
125+
__ https://theupdateframework.github.io/security.html
126+
132127
On January 5, 2013, the Python Software Foundation (PSF) announced that [4]_ a security
133128
breach had occurred on the
134129
python.org wikis for Python and Jython. As a result, all of the wiki data was destroyed.
@@ -174,11 +169,16 @@ compromised.
174169

175170
__ https://mail.python.org/pipermail/distutils-sig/2013-September/022755.html
176171

177-
With the intent to protect PyPI against infrastructure compromises, this PEP
178-
proposes integrating PyPI with The Update Framework [2]_ (TUF). TUF helps
179-
secure new or existing software update systems that can result in clients
180-
being compromised or crashed. It solves these problems by providing a flexible
181-
security framework that can be added to software updaters.
172+
To provide compromise resilient protection of PyPI, this PEP proposes the use of
173+
The Update Framework [2]_ (TUF). TUF provides protection from a variety of
174+
attacks on software update systems, while also providing mechanisms to recover
175+
from a repository compromise. TUF has been used in production by a number of
176+
organizations, including use in Cloud Native Computing Foundation’s Notary
177+
service, which provides the infrastructure for container image signing in Docker
178+
Registry. The TUF specification has been the subject of three independent
179+
security audits__.
180+
181+
__ https://theupdateframework.github.io/audits.html
182182

183183

184184
Threat Model
@@ -188,8 +188,7 @@ The threat model assumes the following:
188188

189189
* Offline keys are safe and securely stored.
190190

191-
* Attackers can compromise at least one of PyPI's trusted keys stored online,
192-
and may do so at once or over a period of time.
191+
* Attackers cannot compromise PyPI's trusted keys stored online.
193192

194193
* Attackers can respond to client requests.
195194

@@ -198,6 +197,10 @@ leave installed) something other than the most up-to-date version of a
198197
software distribution file. If the attacker is preventing the installation
199198
of updates, they do not want clients to realize there is anything wrong.
200199

200+
This threat model describes the minimum security model. The maximum security
201+
model described in PEP 480 also assumes that attackers can compromise PyPI's
202+
online keys.
203+
201204

202205
Definitions
203206
===========
@@ -401,7 +404,7 @@ roles used in TUF.
401404
+-----------------------------------------------------------------------------+
402405
| Roles and Responsibilities |
403406
+-----------------+-----------------------------------------------------------+
404-
| root | The root roles is the locus of trust for the entire |
407+
| root | The root role is the locus of trust for the entire |
405408
| | repository. The root role signs the root.json metadata |
406409
| | file. This file indicates which keys are authorized for |
407410
| | each of the top-level roles, including for the root role |
@@ -580,8 +583,8 @@ This is crucial for the implementation of PEP 480 [21]_.
580583
Metadata Expiry Times
581584
---------------------
582585

583-
The metadata for the *root*, *targets*, and *bins* roles SHOULD each expire in one year, because these
584-
two metadata files are expected to change very rarely.
586+
The metadata for the *root*, *targets*, and *bins* roles SHOULD each expire in
587+
one year, because these metadata files are expected to change very rarely.
585588

586589
The *timestamp*, *snapshot*, and *bin-n* metadata SHOULD each expire in one day
587590
because a CDN or mirror SHOULD synchronize itself with PyPI every day.
@@ -753,13 +756,14 @@ It is primarily used for key revocation, and it is the locus of trust for all
753756
of PyPI. The *root* role signs for the keys that are authorized for each of
754757
the top-level roles (including its own). Keys belonging to the *root* role are
755758
intended to be very well-protected and used with the least frequency of all
756-
keys. It is RECOMMENDED that every PSF board member own a (strong) root key.
759+
keys. It is RECOMMENDED that the PSF board determine the current set of trusted
760+
root key holders, each of whom will own a (strong) root key.
757761
A majority of them can then constitute a quorum to revoke or endow trust in all
758762
top-level keys. Alternatively, the system administrators of PyPI could be
759763
given responsibility for signing for the *root* role. Therefore, the *root*
760-
role SHOULD require (t, n) keys, where n is the number of either all PyPI
761-
administrators or all PSF board members, and t > 1 (so that at least two
762-
members must sign the *root* role).
764+
role SHOULD require (t, n) keys, where n is the number of key holders determined
765+
by the PSF board, and t > 1 (so that at least two members must sign the *root*
766+
role).
763767

764768
The *targets* role will be used only to sign for the static delegation of all
765769
targets to the *bins* role. Since these target delegations must be secured
@@ -945,7 +949,7 @@ written to disk, include its hash in its filename:
945949
where HASH is the `hex digest`__ of the hash of the file contents and
946950
FILENAME is the original filename.
947951

948-
This means that there are multiple copies of every target file, one for each
952+
This means that there MAY be multiple copies of every target file, one for each
949953
of the cryptographic hash functions specified above.
950954

951955
__ https://docs.python.org/3.7/library/hashlib.html#hashlib.hash.hexdigest

0 commit comments

Comments
 (0)