Skip to content

Commit be62d9f

Browse files
authored
Add documentation of security implications (#140)
1 parent 136c4c8 commit be62d9f

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# stub_uploader
1+
# Typeshed Stub Uploader
22

33
[![Build status](https://github.com/typeshed-internal/stub_uploader/actions/workflows/check_scripts.yml/badge.svg)](https://github.com/typeshed-internal/stub_uploader/actions/workflows/check_scripts.yml)
44
[![Upload status](https://github.com/typeshed-internal/stub_uploader/actions/workflows/update_stubs.yml/badge.svg)](https://github.com/typeshed-internal/stub_uploader/actions/workflows/update_stubs.yml)
@@ -60,3 +60,7 @@ and entering `.*` will select all packages.
6060
Note that this action also sorts packages in the dependency order, but it doesn't update the typeshed commit. It may update
6161
[list of uploaded packages](https://github.com/typeshed-internal/stub_uploader/blob/main/data/uploaded_packages.txt)
6262
if this is the first time the package is uploaded.
63+
64+
## Security Implications
65+
66+
Please see the [SECURITY.md](./SECURITY.md) document for more information.

SECURITY.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Security Implication of the Typeshed Stub Uploader
2+
3+
Security for the stub uploader is of the highest importance. If the stub
4+
uploader gets compromised, an attacker could upload manipulated stub
5+
packages to gain full access to developer machines or even production hosts.
6+
Considering the high trust, quick turnaround, and automated installation of
7+
stub packages, this could have significant security implications.
8+
9+
## Maintainers
10+
11+
Only a small number of typeshed maintainers have commit rights for this
12+
repository to minimize the attack vector in case of hacked accounts. This
13+
is also the reason that this repository is part of a separate GitHub
14+
organization and not the [python](https://github.com/python) or
15+
[psf](https://github.com/psf) organizations, like typeshed is.
16+
17+
Typeshed maintainers without commit rights are still considered maintainers
18+
of the stub uploader and are encouraged to manage issues and send and review
19+
pull requests.
20+
21+
## Typeshed Data
22+
23+
To ensure that a compromised typeshed repository can't lead to compromised
24+
stub packages, all typeshed data is verified by the stub uploader before
25+
building packages. The stub uploader ensures that only stub and metadata
26+
files are added to the stub packages. This also means that no code from the
27+
typeshed repository must be executed while building packages, and no
28+
modules must be imported.
29+
30+
## Dependencies
31+
32+
Another possible attack vector is dependencies of stub packages.
33+
A compromised dependency can have a similar effect to when a stub package
34+
gets compromised directly. Therefore, only certain dependencies are
35+
allowed:
36+
37+
* Dependencies on other stub packages created by typeshed.
38+
* Dependencies on packages the upstream package depends on – even recursively.
39+
Since it's likely that a stub package gets installed alongside the
40+
upstream package, this does not introduce an additional security liability.
41+
* Dependencies that are explicitly allowlisted in the stub uploader. These
42+
dependencies are vetted to be from a trusted source.
43+
44+
## PyPI Uploads
45+
46+
Stub packages are uploaded to PyPI by the PyPI user
47+
[typeshed_bot](https://pypi.org/user/typeshed_bot/) using an API token.
48+
The packages are owned solely by that user, so that no other PyPI user can
49+
upload new versions of the packages, in case the PyPI account of a
50+
maintainer becomes compromised.
51+
52+
## Reporting a Vulnerability
53+
54+
To report an issue, go to https://github.com/typeshed-internal/stub_uploader/security. We commit to respond to any issue within 14 days and promptly fix any problems.

0 commit comments

Comments
 (0)