-
-
Notifications
You must be signed in to change notification settings - Fork 995
Initial draft of Python 'Security Policy' #1804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,152 @@ | ||||||||||||||||||||||||||||||||||||||||||
| ========================= | ||||||||||||||||||||||||||||||||||||||||||
| Security and threat model | ||||||||||||||||||||||||||||||||||||||||||
| ========================= | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| The majority of Python Security Response Team (PSRT) | ||||||||||||||||||||||||||||||||||||||||||
| members are volunteers. Therefore, you must respect this volunteered time | ||||||||||||||||||||||||||||||||||||||||||
| by following this security policy. Repeated failure to | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tying "respect their time" to the volunteer aspect feels a bit off to me. Maintainers that have a carve out in their day job for this work deserve the same consideration. Could we drop the conditional framing? Maybe something like "PSRT members balance this work against many other responsibilities. Please be thoughtful about the time and attention your report requires." |
||||||||||||||||||||||||||||||||||||||||||
| respect the security policy will result in future reports | ||||||||||||||||||||||||||||||||||||||||||
| being rejected or being banned from the `python` GitHub organization, regardless of technical merit. | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Also, please wrap lines. |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From @emmatyping:
|
||||||||||||||||||||||||||||||||||||||||||
| What types of bugs are vulnerabilities? | ||||||||||||||||||||||||||||||||||||||||||
| --------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Not all bugs are vulnerabilities. To avoid causing | ||||||||||||||||||||||||||||||||||||||||||
| duplicate work for PSRT members all potential reports | ||||||||||||||||||||||||||||||||||||||||||
| must be evaluated against the relevant threat models | ||||||||||||||||||||||||||||||||||||||||||
| prior to being submitted to the PSRT. | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+17
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Possibly a bit dramatic, but feel free to tone it down 😉
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "this threat model" - since it doesn’t exist yet, I think this change should be postponed. Maybe mark it as
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We immediately go on to describe the assumptions we make, which is close enough to being a threat model that I think we can just call it that. For practical purposes, that's all that really matters. |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Vulnerabilities must be exploitable from code, configurations, | ||||||||||||||||||||||||||||||||||||||||||
| pre-conditions, and deployments that might feasibly exist in | ||||||||||||||||||||||||||||||||||||||||||
| the real world. For example, a vulnerability only affecting code | ||||||||||||||||||||||||||||||||||||||||||
| that does not make sense in a production program | ||||||||||||||||||||||||||||||||||||||||||
| will not be accepted as a vulnerability. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Documented functionality will not be considered a vulnerability. | ||||||||||||||||||||||||||||||||||||||||||
| For example, :mod:`pickle`, :mod:`marshal``, :mod:`shelve``, :mod:`eval``, | ||||||||||||||||||||||||||||||||||||||||||
| and :mod:`exec` are documented to execute arbitrary Python code that is supplied | ||||||||||||||||||||||||||||||||||||||||||
| as data. The :mod:`ctypes` module is documented to enable modifying arbitrary locations in memory. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Vulnerabilities must not depend on malicious control of: | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| * what Python code is executed by the interpreter | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably needs clarifying, since if someone remotely persuades a runtime to execute their arbitrary code, that would be a vulnerability. Perhaps we just want to say something like this instead of the bullet list? Vulnerabilities must not depend on malicious control of Python's launch conditions, including command line arguments, environment variables, or modifications to files on the target system. We assume that, at the time Python is executed, the environment is as intended by the legitimate user, and any malicious variation from this cannot be mitigated by Python itself. |
||||||||||||||||||||||||||||||||||||||||||
| * locations where code is loaded prior to execution (such as current working | ||||||||||||||||||||||||||||||||||||||||||
| directory, ``PYTHONPATH``) | ||||||||||||||||||||||||||||||||||||||||||
| * configuration files | ||||||||||||||||||||||||||||||||||||||||||
| * environment variables | ||||||||||||||||||||||||||||||||||||||||||
| * command line options | ||||||||||||||||||||||||||||||||||||||||||
| * installed packages or modules | ||||||||||||||||||||||||||||||||||||||||||
| * `.pth files <https://docs.python.org/3/library/site.html>`__ | ||||||||||||||||||||||||||||||||||||||||||
| * caches or ``.pyc`` files | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Vulnerabilities that affect availability (such as DoS, ReDoS) must be | ||||||||||||||||||||||||||||||||||||||||||
| triggerable with data inputs that are reasonably sized for the use-case. | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe: "...Otherwise if that is not the case and the module has an explicit warning they can be reported publicly" |
||||||||||||||||||||||||||||||||||||||||||
| Availability vulnerabilities must also demonstrate an "upward" change in posture | ||||||||||||||||||||||||||||||||||||||||||
| for the attacker, rather than a "lateral" change in posture. | ||||||||||||||||||||||||||||||||||||||||||
| This is to avoid handling performance improvements as security vulnerabilities. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Vulnerabilities in dependencies of Python (such as zlib, Tcl/Tk, or OpenSSL) | ||||||||||||||||||||||||||||||||||||||||||
| are not vulnerabilities in Python unless Python's use of the dependency | ||||||||||||||||||||||||||||||||||||||||||
| interferes with secure use of the dependency. | ||||||||||||||||||||||||||||||||||||||||||
| For example, Python is not vulnerable because it bundles a vulnerable | ||||||||||||||||||||||||||||||||||||||||||
| version of zlib, users are expected to upgrade their own dependencies. | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comma splice. Also, is this right? Seems like we often take security upgrades of bundled dependencies such as expat.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly we also bundle the deps on some platforms (Windows), so our sources (
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the idea is that we do not currently create patch releases when a dependency has a security vulnerability, or mitigate against vulnerable system dependencies.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Plus users can't be expected to upgrade a bundled dependency, so the sentence needs a bit of reframing. "For example, a vulnerability in the bundled copy of zlib in Python is a vulnerability in zlib, not Python." I don't think we need to mention "users can upgrade their own dependencies". Maybe we need a written policy somewhere else on how we choose to release updates to our binary distros in light of bundled libraries though? Not here I don't think. |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| The complete threat model for Python and standard library modules | ||||||||||||||||||||||||||||||||||||||||||
| is available in the Threat Model section of the Python Developer Guide. | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that a reference to this page?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That page doesn’t exist yet, so let's not reference it. |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| What versions of Python are accepting reports? | ||||||||||||||||||||||||||||||||||||||||||
| ---------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Python accepts security vulnerabilities and will | ||||||||||||||||||||||||||||||||||||||||||
| assign CVE IDs for `supported Python versions`_ that have a status of | ||||||||||||||||||||||||||||||||||||||||||
| `"bugfix" or "security" <python-status>`_. Versions that are not yet | ||||||||||||||||||||||||||||||||||||||||||
| stable (status of `"feature" or "prerelease" <python-status>`_) are not | ||||||||||||||||||||||||||||||||||||||||||
| eligible for CVE IDs. If the vulnerability exclusively exists in | ||||||||||||||||||||||||||||||||||||||||||
| non-stable versions, then the issue should be handled as a public bug issue. | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+65
to
+66
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Sometimes features may be marked as | ||||||||||||||||||||||||||||||||||||||||||
| "experimental" in Python, even in a stable Python version. | ||||||||||||||||||||||||||||||||||||||||||
| These features are not eligible for security vulnerabilities. | ||||||||||||||||||||||||||||||||||||||||||
| Instead open a public GitHub issue. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If a vulnerability is platform-dependent, check if the platform is | ||||||||||||||||||||||||||||||||||||||||||
| `supported per :pep:`11`. | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
| Vulnerabilities that exclusively affect unsupported platforms | ||||||||||||||||||||||||||||||||||||||||||
| may not be accepted. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| .. _supported Python versions: https://devguide.python.org/versions/ | ||||||||||||||||||||||||||||||||||||||||||
| .. _python-status: https://devguide.python.org/versions/#status-key | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+77
to
+78
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| What to include and how to structure a vulnerability report? | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non-blocking, maybe followups: Should we request that people include a practical exploit proof of concept or not? Also: The recently realized theme around "if it was discovered using a publicly available LLM, we may request that it be worked on in public because we should assume a bunch of others have also discovered it and not reported it - or soon will" might be something to codify in here. But probably as a followup a bit later?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, there are reports that absolutely need a PoC, and others that are just made way more complex when reporters try to create one. So I don't think we can have a clear rule on that one, unfortunately. "Include a PoC if it's not obvious how it may be exploited, and we may request one if you don't but we need it"? I don't like that wording, but it's basically the reality. On tools, "if it was discovered using a publicly available tool, we may request ..." is probably fine. If someone just fires up an open source fuzzer or a new public linter and finds something, it's kinda fair to assume it's not secret. LLMs aren't really that special here, they're just much more versatile than the scanning tools we had before (and more hype, and easier to set up, somehow). |
||||||||||||||||||||||||||||||||||||||||||
| ------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| For your vulnerability report to be handled efficiently by | ||||||||||||||||||||||||||||||||||||||||||
| the PSRT, the report must include certain information and | ||||||||||||||||||||||||||||||||||||||||||
| be formatted correctly: | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| * For the initial report and follow-up communications, avoid | ||||||||||||||||||||||||||||||||||||||||||
| overly long, verbose, or excessive structure (such as headers or tables). | ||||||||||||||||||||||||||||||||||||||||||
| Ideally reports should be a few sentences describing the vulnerability and | ||||||||||||||||||||||||||||||||||||||||||
| a proof-of-concept script that reproduces the issue. | ||||||||||||||||||||||||||||||||||||||||||
| * When reporting large numbers or "batches" of vulnerabilities or | ||||||||||||||||||||||||||||||||||||||||||
| searching for potential vulnerabilities using an LLM, you as a reporter must | ||||||||||||||||||||||||||||||||||||||||||
| verify the validity of all reports prior to submission to the PSRT. | ||||||||||||||||||||||||||||||||||||||||||
| PSRT members WILL NOT spend time confirming the validity of reports, only | ||||||||||||||||||||||||||||||||||||||||||
| whether a valid bug report is a vulnerability or not. | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+94
to
+95
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is maybe confusingly worded. We probably should verify a vulnerability is a vulnerability. |
||||||||||||||||||||||||||||||||||||||||||
| * Do not include severity or CVSS information in your initial report, | ||||||||||||||||||||||||||||||||||||||||||
| this information will be determined by the PSRT. | ||||||||||||||||||||||||||||||||||||||||||
| * Ideally, include a minimal patch with the mitigation for the report. | ||||||||||||||||||||||||||||||||||||||||||
| * If the vulnerability only affects certain Python versions, optionally | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: Should we include some text saying the reporter should also attempt to reproduce the problem on the |
||||||||||||||||||||||||||||||||||||||||||
| include the versions of Python that are affected. | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+100
to
+101
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
| * Reports that do not contain a potential security vulnerability (such as spam | ||||||||||||||||||||||||||||||||||||||||||
| or requesting compliance or due-diligence work) | ||||||||||||||||||||||||||||||||||||||||||
| will be discarded without a reply. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest adding "notebooks," we always get those :-/ |
||||||||||||||||||||||||||||||||||||||||||
| How to submit a vulnerability report? | ||||||||||||||||||||||||||||||||||||||||||
| ------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Submit all potential security vulnerability reports for CPython | ||||||||||||||||||||||||||||||||||||||||||
| to GitHub Security Advisories | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be cautious with this wording, we don't want reports sent to GitHub itself. |
||||||||||||||||||||||||||||||||||||||||||
| by `opening a new ticket <GHSA>`__. | ||||||||||||||||||||||||||||||||||||||||||
| Do not open a public GitHub issue to report a security vulnerability. | ||||||||||||||||||||||||||||||||||||||||||
| For all other projects (such as pip, python.org and tools) or if you're | ||||||||||||||||||||||||||||||||||||||||||
| not sure where to send your report, send an email to | ||||||||||||||||||||||||||||||||||||||||||
| `security@python.org <mailto:security@python.org>`__. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Here's what to expect for how a vulnerability report will be handled: | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| * Reporter reports the vulnerability privately to the PSRT. | ||||||||||||||||||||||||||||||||||||||||||
| * If the PSRT determines the report isn't a vulnerability, the issue | ||||||||||||||||||||||||||||||||||||||||||
| can be opened in the public issue tracker. | ||||||||||||||||||||||||||||||||||||||||||
| * If the PSRT determines the report is a vulnerability, the PSRT will | ||||||||||||||||||||||||||||||||||||||||||
| accept your report and a CVE ID will be assigned by the PSF CNA. | ||||||||||||||||||||||||||||||||||||||||||
| * Once a public pull request containing a fix is merged to CPython, | ||||||||||||||||||||||||||||||||||||||||||
| the advisory and CVE record will be published with attribution. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| For more information about how the PSRT handles vulnerabilities, | ||||||||||||||||||||||||||||||||||||||||||
| `consult the Python Developer Guide <https://devguide.python.org/developer-workflow/psrt/#triaging-a-vulnerability-report>`__. | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| PSF Code of Conduct | ||||||||||||||||||||||||||||||||||||||||||
| ------------------- | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Well-being and safety of the Python Security Response Team members is | ||||||||||||||||||||||||||||||||||||||||||
| prioritized over the technical merit of vulnerability reports. | ||||||||||||||||||||||||||||||||||||||||||
| Despite communications being private, vulnerability reporting is subject | ||||||||||||||||||||||||||||||||||||||||||
| to the `PSF Code of Conduct`_. Violations will be reported to the Code of Conduct | ||||||||||||||||||||||||||||||||||||||||||
| team with undisclosed vulnerability information removed, if applicable. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| .. _GHSA: https://github.com/python/cpython/security/advisories/new | ||||||||||||||||||||||||||||||||||||||||||
| .. _PSF Code of Conduct: https://policies.python.org/python.org/code-of-conduct/ | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| CVE Numbering Authority (CNA) | ||||||||||||||||||||||||||||||||||||||||||
| ----------------------------- | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| The Python and pip projects are scoped under the | ||||||||||||||||||||||||||||||||||||||||||
| `Python Software Foundation CVE Numbering Authority <CNA>`__ | ||||||||||||||||||||||||||||||||||||||||||
| (CNA). This means you must submit all security | ||||||||||||||||||||||||||||||||||||||||||
| vulnerability reports to the PSRT to receive | ||||||||||||||||||||||||||||||||||||||||||
| a CVE ID for Python or pip. To reach the PSF | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+148
to
+149
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
| CNA contact directly, send an email to | ||||||||||||||||||||||||||||||||||||||||||
| `cna@python.org <mailto:cna@python.org>`__. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| .. _CNA: https://www.python.org/cve-numbering-authority/ | ||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.