Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.12] gh-114539: Clarify implicit launching of shells by subprocess (GH-117996)#118002

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zooba merged 1 commit intopython:3.12frommiss-islington:backport-a4b44d3-3.12
Apr 17, 2024
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-114539: Clarify implicit launching of shells by subprocess (GH-117996
)(cherry picked from commita4b44d3)Co-authored-by: Steve Dower <steve.dower@python.org>
  • Loading branch information
@zooba@miss-islington
zooba authored andmiss-islington committedApr 17, 2024
commitb7f8c777cd5972ea1c6118cb0629c2f41745ce50
12 changes: 10 additions & 2 deletionsDoc/library/subprocess.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -754,8 +754,8 @@ Exceptions defined in this module all inherit from :exc:`SubprocessError`.
Security Considerations
-----------------------

Unlike some other popen functions, thisimplementation willnever
implicitly call a system shell. This means that all characters,
Unlike some other popen functions, thislibrary willnot
implicitlychoose tocall a system shell. This means that all characters,
including shell metacharacters, can safely be passed to child processes.
If the shell is invoked explicitly, via ``shell=True``, it is the application's
responsibility to ensure that all whitespace and metacharacters are
Expand All@@ -764,6 +764,14 @@ quoted appropriately to avoid
vulnerabilities. On :ref:`some platforms <shlex-quote-warning>`, it is possible
to use :func:`shlex.quote` for this escaping.

On Windows, batch files (:file:`*.bat` or :file:`*.cmd`) may be launched by the
operating system in a system shell regardless of the arguments passed to this
library. This could result in arguments being parsed according to shell rules,
but without any escaping added by Python. If you are intentionally launching a
batch file with arguments from untrusted sources, consider passing
``shell=True`` to allow Python to escape special characters. See :gh:`114539`
for additional discussion.


Popen Objects
-------------
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp