@@ -4,23 +4,50 @@ title: Security Model and Considerations
4
4
5
5
# Security model and considerations
6
6
7
- ## General considerations
8
-
9
- While more secure than passwords and long-lived API tokens, OIDC publishing
10
- is not a panacea. In particular:
11
-
12
- * Short-lived API tokens are still sensitive material, and should not be
13
- disclosed (ideally not at all, but certainly not before they expire).
14
-
15
- * OIDC tokens themselves are sensitive material, and should not be disclosed.
16
- OIDC tokens are also short-lived, but an attacker who successfully intercepts
17
- one can mint API tokens against it for as long as it lives.
7
+ Trusted Publishing is primarily designed to be a more secure alternative to
8
+ the long-lived API tokens that have traditionally been used for publishing to
9
+ PyPI.
10
+
11
+ In recent years, theft of credentials such as API tokens has [ played a major
12
+ role in cyber attacks] . The reason for this is the unfortunate reality that
13
+ managing credentials can be complicated and risky. Trusted Publishing reduces
14
+ this risk by using short-lived tokens instead of long-lived tokens. Short-lived
15
+ tokens are less likely to be misplaced, leaked in logs, or stolen by malware
16
+ since they don't have to be stored. Additionally, if short-lived tokens are
17
+ leaked, they only give attackers a narrow time window to exploit the leaked
18
+ token, which minimizes the potential damage.
19
+
20
+ However, it is important to still be aware of the kinds of risks that
21
+ Trusted Publishing does not cover. You should think of Trusted Publishing as one
22
+ tool in the toolbelt for securing packages.
18
23
19
- * Configuring a Trusted Publisher means establishing trust in a particular piece
20
- of external state (such as a GitHub Actions workflow); that state ** must not**
21
- be controllable by untrusted parties.
24
+ ## General considerations
22
25
23
- In summary: treat your Trusted Publishers * as if* they were API tokens. If you
26
+ * Trusted Publishing uses short-lived API tokens that expire
27
+ no more than 15 minutes after the OIDC flow that authorizes them.
28
+ Just like normal API authentication, Trusted Publishing
29
+ does not assert the safety of the code or the trustworthiness
30
+ of its authors.
31
+
32
+ * Trusted Publishing does not address whether the package has been modified
33
+ before or after it was built. [ Attestations] can address those risks.
34
+
35
+ * Short-lived API tokens are sensitive material that must be protected from
36
+ getting stolen or leaked.
37
+
38
+ * OIDC tokens themselves are also sensitive material that must be protected
39
+ from getting stolen or leaked. OIDC tokens expire quickly, but an attacker who
40
+ successfully intercepts one can use it to generate API tokens until it
41
+ expires.
42
+
43
+ * Configuring a Trusted Publisher means trusting an identity provider (IdP),
44
+ such as GitHub Actions. Trusted Publishing relies on the integrity of that
45
+ IdP and the actors that are authorized to use it. In practice, this means
46
+ that users of Trusted Publishing must protect and secure the CI/CD workflows
47
+ that they register as Trusted Publishers, as weaknesses in those workflows
48
+ can be equivalent to credential compromise.
49
+
50
+ In summary: treat your Trusted Publishers * as if* they are API tokens. If you
24
51
wouldn't let a user or piece of code access your API token, then they shouldn't
25
52
be able to invoke your Trusted Publisher.
26
53
@@ -147,7 +174,7 @@ own security model and considerations.
147
174
When using Trusted Publishing with Google Cloud, you must trust the service account
148
175
and _any service which uses it as the default ephemeral identity_.
149
176
150
- Specifically, it is not recommened to configure the [default service
177
+ Specifically, it is not recommended to configure the [default service
151
178
accounts](https://cloud.google.com/iam/docs/service-account-types#default), as
152
179
they are provided by default to every service when they are created.
153
180
@@ -258,6 +285,10 @@ own security model and considerations.
258
285
access the OIDC token to a bare minimum. This prevents both accidental
259
286
and malicious disclosure.
260
287
288
+ [ played a major role in cyber attacks ] : https://therecord.media/cisa-cyberattacks-using-valid-credentials
289
+
290
+ [ Attestations ] : /attestations/
291
+
261
292
[ fundamentally dangerous ] : https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
262
293
263
294
[ Use a dedicated environment ] : https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
0 commit comments