-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-42988: Remove the pydoc getfile feature #25015
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
Conversation
I kept links to the source file using
This doesn't work if the pydoc server is accessed from a different machine, but the common usage (IMO) is to only run pydoc locally since pydoc only listen on the local link (localhost) by default. |
These links don't work when the pydoc server is accessed from a different machine. An alternative is to simply remove these links and let the user open the file manually, since the path is given in the HTML page (just copy/paste the path). |
My two cents: this looks like an acceptable compromise to me. A quick survey among other Pythonistas I know show that the pydoc feature is seldomly used, the HTTP server even less so, and the Removing a vulnerable feature that almost nobody uses is much less work than trying to fix the bug (the other PRs trying to fix it already add quite a bit of complexity - and who knows what else the attackers will find ?) I would suggest to consider fixing the bugs instead of removing the feature only if enough people complain. |
@Fidget-Spinner @serhiy-storchaka: Would you mind to review this PR? Are you ok with this compromise? https://bugs.python.org/issue42988#msg389452 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind to review this PR?
From a technical point of view, this PR looks good. Thanks for taking the time to do this Victor!
Are you ok with this compromise? https://bugs.python.org/issue42988#msg389452
I'm waiting for some consensus on the bug tracker by the core devs. Personally I don't really have a strong opinion, so a +0 ;) - I wouldn't oppose if this were accepted.
Misc/NEWS.d/next/Security/2021-03-24-14-16-56.bpo-42988.P2aNco.rst
Outdated
Show resolved
Hide resolved
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vstinner. This looks like a reasonable and safe approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had 4 other ways to fix it in https://bugs.python.org/issue42988, didn't though about removing it... but I'm happy with removing it! It keeps things simple.
The other ways adds too much complexity that do not balance well with the usage of this feature (I, too, suspect nobody uses this).
@serhiy-storchaka: I would prefer to get your opinion on this PR, but I don't want to wait too long since https://bugs.python.org/issue42988 vulnerability was already reported 3 months ago and got a CVE number. The PR already got 3 approvals. I plan to merge this PR next week (not sure when exactly). Tell me if you want me to wait for your review or not. |
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7, 3.8, 3.9. |
GH-25064 is a backport of this pull request to the 3.9 branch. |
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org>
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org>
GH-25065 is a backport of this pull request to the 3.8 branch. |
Thanks for the reviews! I love fixing security vulnerabilities by removing code! |
GH-25066 is a backport of this pull request to the 3.7 branch. |
GH-25067 is a backport of this pull request to the 3.6 branch. |
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org>
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org>
|
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org>
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org>
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer. (cherry picked from commit 9b99947) Co-authored-by: Victor Stinner <vstinner@python.org>
CVE-2021-3426: Remove the "getfile" feature of the pydoc module which
could be abused to read arbitrary files on the disk (directory
traversal vulnerability). Moreover, even the Python modules source
code can contain sensitive data like passwords. Vulnerability
reported by David Schwörer.
https://bugs.python.org/issue42988