-
-
Notifications
You must be signed in to change notification settings - Fork 994
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
Open
sethmlarson
wants to merge
12
commits into
python:main
Choose a base branch
from
sethmlarson:security-policy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+162
−0
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ee802b2
Initial draft of Python 'Security Policy'
sethmlarson ac7db7f
Apply suggestions from code review
sethmlarson 8467434
Address review feedback
sethmlarson e12f3a9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f5878b8
Apply suggestions from code review
sethmlarson 30c94d6
Wrap lines
sethmlarson ab10ebe
Address more review feedback
sethmlarson 39e11fd
Apply suggestions from code review
sethmlarson 2d403e1
Address more review comments
sethmlarson 4d6859c
Collapsed sections, real-world applicability
sethmlarson b29e108
exist
sethmlarson 9c25cab
Apply suggestions from code review
sethmlarson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,5 +7,6 @@ Security | |
| .. toctree:: | ||
| :maxdepth: 5 | ||
|
|
||
| policy | ||
| psrt | ||
| sbom | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| =============== | ||
| Security policy | ||
| =============== | ||
|
|
||
| :ref:`Python Security Response Team <psrt>` (PSRT) members balance this work against | ||
| many other responsibilities. Please be thoughtful about the time and attention | ||
| your report requires. Repeated failure to respect the security policy will | ||
| result in future reports being rejected, or the reporter being banned from the | ||
| ``python`` GitHub organization, regardless of technical merit. | ||
|
|
||
| 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. | ||
| Where possible, cite the relevant threat model to show that | ||
| the latter has been considered while determining whether | ||
| to report a bug as a vulnerability. | ||
|
|
||
| Vulnerabilities must be exploitable from code, configurations, | ||
| pre-conditions, or deployments that may 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 is not considered a vulnerability. | ||
| For example, :mod:`pickle`, :mod:`marshal`, :mod:`shelve`, :func:`eval`, | ||
| and :func:`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 Python's launch | ||
| conditions, including (but not limited to) 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. | ||
|
|
||
| Vulnerabilities that affect availability (such as DoS, ReDoS, crashes, | ||
| dead-locks, and resource exhaustion) must be | ||
| triggerable with data inputs that are reasonably sized for the use case. | ||
| Availability vulnerabilities must also demonstrate an "upward" change in posture | ||
| for the attacker, rather than a "lateral" one. | ||
| 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, a vulnerability in the bundled copy of zlib in Python is a | ||
| vulnerability in zlib, not Python. | ||
|
|
||
| What versions of Python accept reports? | ||
| --------------------------------------- | ||
|
|
||
| Python accepts vulnerability reports and will | ||
| assign CVE IDs for :ref:`supported Python versions <branchstatus>` that have a | ||
| status of :ref:`"bugfix" or "security" <version-status-key>`. Versions that are | ||
| not yet stable (status of :ref:`"feature" or "prerelease" <version-status-key>`) | ||
| are not eligible for CVE IDs. If the vulnerability only exists in prerelease | ||
| versions (alphas, betas, release candidates), then the issue should be reported | ||
| as a regular bug. | ||
| Prior to submitting a report, check whether the issue has already been | ||
| resolved on the ``main`` branch and only requires backporting. | ||
|
|
||
| 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`. | ||
| Vulnerabilities that exclusively affect unsupported platforms | ||
| may not be accepted. | ||
|
|
||
| What to include and how to structure a vulnerability report? | ||
| ------------------------------------------------------------ | ||
|
|
||
| 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 and provides a clear | ||
| indication of whether the vulnerability is still present (such as exiting with | ||
| ``1`` if vulnerable and ``0`` if not vulnerable). | ||
| * When reporting large numbers or "batches" of vulnerabilities or | ||
| searching for potential vulnerabilities using an LLM, you as a reporter must | ||
| verify the factual validity (such as whether APIs have been hallucinated) | ||
| of the content in all reports prior to submission to the PSRT. | ||
| * 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. | ||
| * Always include the versions of Python that were tested, | ||
| and indicate which were found to be vulnerable. | ||
| * Submit reports as plain-text only, including attachments. | ||
|
sethmlarson marked this conversation as resolved.
|
||
| No PDFs, binaries, notebooks, or other files that cannot be safely reviewed. | ||
| If your proof-of-concept depends on a specially constructed binary file, | ||
| please include a script to construct it rather than the file itself. | ||
| * Proof-of-concept scripts longer than a few lines should be wrapped with a | ||
| `collapsed section`_ using ``<details></details>`` for better readability. | ||
| * 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. | ||
|
|
||
| .. _collapsed section: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections | ||
|
|
||
| How to submit a vulnerability report? | ||
| ------------------------------------- | ||
|
|
||
| Submit all potential security vulnerability reports for CPython | ||
| 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 | ||
| `[email protected] <mailto:[email protected]>`__. | ||
|
|
||
| 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 reporter | ||
| may open a public issue. | ||
| * If the PSRT determines the report is a vulnerability, the PSRT will | ||
| accept the 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, | ||
| see :ref:`psrt-vulnerability-process`. | ||
|
|
||
| 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 for a CVE ID | ||
| to be issued for Python or pip. To reach the PSF | ||
| CNA contact directly, send an email to | ||
| `[email protected] <mailto:[email protected]>`__. | ||
|
|
||
| .. _CNA: https://www.python.org/cve-numbering-authority/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.