Skip to content

Commit 676b9df

Browse files
committed
Initial draft of Python 'Security Policy'
1 parent f890063 commit 676b9df

2 files changed

Lines changed: 154 additions & 0 deletions

File tree

index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ Full table of contents
288288
testing/index
289289
development-tools/index
290290
core-team/index
291+
security-and-threat-model/index
291292
internals
292293
versions
293294

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
=========================
2+
Security and threat model
3+
=========================
4+
5+
The majority of Python Security Response Team
6+
members are volunteers and therefore you must respect this volunteered time
7+
by following this security policy. Repeated failure to
8+
respect the security policy will result in future reports
9+
being rejected, regardless of technical merit.
10+
11+
What types of bugs are vulnerabilities?
12+
---------------------------------------
13+
14+
Not all bugs are vulnerabilities. To avoid causing
15+
duplicate work for PSRT members all potential reports
16+
must be evaluated against the relevant threat model(s)
17+
prior to being submitted to the PSRT.
18+
19+
Vulnerabilities must be exploitable from code, configurations,
20+
pre-conditions, and deployments that might feasibly exist in
21+
the real-world. For example, a vulnerability only affecting code
22+
that does not make sense to write in a production program
23+
will not be accepted as a vulnerability.
24+
25+
Documented functionality will not be considered a vulnerability.
26+
For example, ``pickle``, ``marshal``, ``shelve``, ``eval``, and ``exec``
27+
are documented to execute arbitrary Python code that is supplied as data.
28+
The ``ctypes`` module is documented to enable modifying arbitrary locations
29+
in memory.
30+
31+
Vulnerabilities must not depend on malicious control of:
32+
33+
* what Python code is executed by the interpreter
34+
* locations where code is loaded prior to execution (such as current working
35+
directory, ``PYTHONPATH``)
36+
* configuration files
37+
* environment variables
38+
* command line options
39+
* installed packages or modules
40+
* `.pth files <https://docs.python.org/3/library/site.html>`__
41+
* caches or ``.pyc`` files
42+
43+
Vulnerabilities that affect availability (such as DoS, ReDoS) must be
44+
triggerable with data inputs that are reasonably sized for the use-case.
45+
Availability vulnerabilities must also demonstrate an "upward" change in posture
46+
for the attacker, rather than a "lateral" change in posture.
47+
This is to avoid handling performance improvements as security vulnerabilities.
48+
49+
Vulnerabilities in dependencies of Python (such as zlib, Tcl/Tk, or OpenSSL)
50+
are not vulnerabilities in Python unless Python's usage of the dependency
51+
interferes with secure usage of the dependency.
52+
For example, Python is not vulnerable because it bundles a vulnerable
53+
version of zlib, users are expected to upgrade their own dependencies.
54+
55+
The complete threat model for Python and standard library modules,
56+
is available in the Threat Model section of the Python Developer Guide.
57+
58+
What versions of Python are accepting reports?
59+
----------------------------------------------
60+
61+
Python accepts security vulnerabilities and will
62+
assign CVE IDs for `supported Python versions`_ that have a status of
63+
`"bugfix" or "security" <python-status>`_. Versions that are not yet
64+
stable (status of `"feature" or "prerelease" <python-status>`_) are not
65+
eligible for CVE IDs. If the vulnerability exclusively exists in
66+
non-stable versions, then the issue should be handled as a public bug issue.
67+
68+
Sometimes features may be marked as
69+
"experimental" in Python, even in a stable Python version.
70+
These features are not eligible for security vulnerabilities,
71+
instead open a public GitHub issue.
72+
73+
If a vulnerability is platform-dependent, check if the platform is a
74+
`supported platform per PEP 11 <https://peps.python.org/pep-0011/>`__.
75+
Vulnerabilities that exclusively affect unsupported platforms
76+
may not be accepted.
77+
78+
.. _supported Python versions: https://devguide.python.org/versions/
79+
.. _python-status: https://devguide.python.org/versions/#status-key
80+
81+
What to include and how to structure a vulnerability report?
82+
------------------------------------------------------------
83+
84+
For your vulnerability report to be handled efficiently by
85+
the PSRT, the report must include certain information and
86+
be formatted correctly:
87+
88+
* For the initial report and follow-up communications, avoid
89+
overly long, verbose, or excessive structure (such as headers or tables).
90+
Ideally reports should be a few sentences describing the vulnerability and
91+
a proof-of-concept script that reproduces the issue.
92+
* When reporting large numbers or "batches" of vulnerabilities or
93+
searching for potential vulnerabilities using an LLM, you as a reporter must
94+
verify the validity of all reports prior to submission to the PSRT.
95+
PSRT members WILL NOT spend time confirming the validity of reports, only
96+
whether a valid bug report is a vulnerability or not.
97+
* Do not include severity or CVSS information in your initial report,
98+
this information will be determined by the PSRT.
99+
* Optionally, include a minimal patch with the mitigation for the report.
100+
* If the vulnerability only affects certain Python versions, optionally
101+
include the versions of Python that are affected.
102+
* Reports that do not contain a potential security vulnerability (such as spam
103+
or requesting compliance or due-diligence work)
104+
will be discarded without a reply.
105+
106+
How to submit a vulnerability report?
107+
-------------------------------------
108+
109+
Submit all potential security vulnerability reports for CPython
110+
to `GitHub Security Advisories <GHSA>`__
111+
by `opening a new ticket <GHSA>`__.
112+
Do not open a public GitHub issue to report a security vulnerability.
113+
For all other projects (pip, python.org, tools, etc) or if you're
114+
not sure where to send your report, send an email to
115+
`security at python dot org <mailto:security@python.org>`__.
116+
117+
Here's what to expect for how a vulnerability report will be handled:
118+
119+
* Reporter reports the vulnerability privately to the PSRT.
120+
* If the PSRT determines the report isn't a vulnerability, the issue
121+
can be opened in the public issue tracker.
122+
* If the PSRT determines the report is a vulnerability, the PSRT will
123+
accept your report and a CVE ID will be assigned by the PSF CNA.
124+
* Once a public pull request containing a fix is merged to CPython,
125+
the advisory and CVE record will be published with attribution.
126+
127+
For more information about how the PSRT handles vulnerabilities,
128+
`consult the Python Developer Guide <https://devguide.python.org/developer-workflow/psrt/#triaging-a-vulnerability-report>`__.
129+
130+
PSF Code of Conduct
131+
-------------------
132+
133+
Well-being and safety of the Python Security Response Team members is
134+
prioritized over the technical merit of vulnerability reports.
135+
Despite communications being private, vulnerability reporting is subject
136+
to the `PSF Code of Conduct`_. Violations will be reported to the Code of Conduct
137+
team with undisclosed vulnerability information removed, if applicable.
138+
139+
.. _GHSA: https://github.com/python/cpython/security/advisories/new
140+
.. _PSF Code of Conduct: https://policies.python.org/python.org/code-of-conduct/
141+
142+
CVE Numbering Authority (CNA)
143+
-----------------------------
144+
145+
The Python and pip projects are scoped under the
146+
`Python Software Foundation CVE Numbering Authority <CNA>`__
147+
(CNA). This means you must submit all security
148+
vulnerability reports to the PSRT to receive
149+
a CVE ID for Python or pip. To reach the PSF
150+
CNA contact directly, send an email to
151+
`cna at python dot org <mailto:cna@python.org>`__.
152+
153+
.. _CNA: https://www.python.org/cve-numbering-authority/

0 commit comments

Comments
 (0)