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

Commitad5159b

Browse files
gh-87604: Clarify in docs that sys.addaudithook is not for sandboxes (GH-99372)
(cherry picked from commitc3c3871)Co-authored-by: Steve Dower <steve.dower@python.org>
1 parent5612471 commitad5159b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎Doc/library/sys.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ always available.
3535
can then log the event, raise an exception to abort the operation,
3636
or terminate the process entirely.
3737

38+
Note that audit hooks are primarily for collecting information about internal
39+
or otherwise unobservable actions, whether by Python or libraries written in
40+
Python. They are not suitable for implementing a "sandbox". In particular,
41+
malicious code can trivially disable or bypass hooks added using this
42+
function. At a minimum, any security-sensitive hooks must be added using the
43+
C API:c:func:`PySys_AddAuditHook` before initialising the runtime, and any
44+
modules allowing arbitrary memory modification (such as:mod:`ctypes`) should
45+
be completely removed or closely monitored.
46+
3847
..audit-event::sys.addaudithook "" sys.addaudithook
3948

4049
Calling:func:`sys.addaudithook` will itself raise an auditing event

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp