8000 bpo-37363: Add audit events for a range of modules (GH-14301) · miss-islington/cpython@60419a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 60419a7

Browse files
authored
bpo-37363: Add audit events for a range of modules (pythonGH-14301)
1 parent 9bbf4d7 commit 60419a7

37 files changed

+165
-18
lines changed

Doc/library/ctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ Data types
20462046
.. audit-event:: ctypes.cdata address
20472047

20482048
This method, and others that indirectly call this method, raises an
2049-
:func:`auditing event <sys.audit>` ``ctypes.cdata`` with argument
2049+
:ref:`auditing event <auditing>` ``ctypes.cdata`` with argument
20502050
``address``.
20512051

20522052
.. method:: from_param(obj)

Doc/library/ensurepip.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ Module API
119119
*verbosity* controls the level of output to :data:`sys.stdout` from the
120120
bootstrapping operation.
121121

122+
.. audit-event:: ensurepip.bootstrap root
123+
122124
.. note::
123125

124126
The bootstrapping process has side effects on both ``sys.path`` and

Doc/library/ftplib.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
190190
*source_address* is a 2-tuple ``(host, port)`` for the socket to bind to as
191191
its source address before connecting.
192192

193+
.. audit-event:: ftplib.FTP.connect "self host port"
194+
193195
.. versionchanged:: 3.3
194196
*source_address* parameter was added.
195197

@@ -223,13 +225,17 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
223225

224226
Send a simple command string to the server and return the response string.
225227

228+
.. audit-event:: ftplib.FTP.sendcmd "self cmd"
229+
226230

227231
.. method:: FTP.voidcmd(cmd)
228232

229233
Send a simple command string to the server and handle the response. Return
230234
nothing if a response code corresponding to success (codes in the range
231235
200--299) is received. Raise :exc:`error_reply` otherwise.
232236

237+
.. audit-event:: ftplib.FTP.sendcmd "self cmd"
238+
233239

234240
.. method:: FTP.retrbinary(cmd, callback, blocksize=8192, rest=None)
235241

Doc/library/functions.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ are always available. They are listed here in alphabetical order.
128128
:func:`breakpoint` will automatically call that, allowing you to drop into
129129
the debugger of choice.
130130

131+
.. audit-event:: builtins.breakpoint "sys.breakpointhook"
132+
131133
.. versionadded:: 3.7
132134

133135
.. _func-bytearray:
@@ -277,7 +279,7 @@ are always available. They are listed here in alphabetical order.
277279

278280
.. audit-event:: compile "source filename"
279281

280-
Raises an :func:`auditing event <sys.audit>` ``compile`` with arguments
282+
Raises an :ref:`auditing event <auditing>` ``compile`` with arguments
281283
``source`` and ``filename``. This event may also be raised by implicit
282284
compilation.
283285

@@ -490,8 +492,8 @@ are always available. They are listed here in alphabetical order.
490492

491493
.. audit-event:: exec code_object
492494

493-
Raises an :func:`auditing event <sys.audit>` ``exec`` with the code object as
494-
the argument. Code compilation events may also be raised.
495+
Raises an :ref:`auditing event <auditing>` ``exec`` with the code object
496+
as the argument. Code compilation events may also be raised.
495497

496498
.. index:: builtin: exec
497499

@@ -525,8 +527,8 @@ are always available. They are listed here in alphabetical order.
525527

526528
.. audit-event:: exec code_object
527529

528-
Raises an :func:`auditing event <sys.audit>` ``exec`` with the code object as
529-
the argument. Code compilation events may also be raised.
530+
Raises an :ref:`auditing event <auditing>` ``exec`` with the code object
531+
as the argument. Code compilation events may also be raised.
530532

531533
.. note::
532534

@@ -779,7 +781,7 @@ are always available. They are listed here in alphabetical order.
779781

780782
.. audit-event:: builtins.input prompt
781783

782-
Raises an :func:`auditing event <sys.audit>` ``builtins.input`` with
784+
Raises an :ref:`auditing event <auditing>` ``builtins.input`` with
783785
argument ``prompt`` before reading input
784786

785787
.. audit-event:: builtins.input/result result

Doc/library/glob.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ For example, ``'[?]'`` matches the character ``'?'``.
5252
more directories and subdirectories. If the pattern is followed by an
5353
``os.sep``, only directories and subdirectories match.
5454

55+
.. audit-event:: glob.glob "pathname recursive"
56+
5557
.. note::
5658
Using the "``**``" pattern in large directory trees may consume
5759
an inordinate amount of time.
@@ -65,6 +67,8 @@ For example, ``'[?]'`` matches the character ``'?'``.
6567
Return an :term:`iterator` which yields the same values as :func:`glob`
6668
without actually storing them all simultaneously.
6769

70+
.. audit-event:: glob.glob "pathname recursive"
71+
6872

6973
.. function:: escape(pathname)
7074

Doc/library/imaplib.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ An :class:`IMAP4` instance has the following methods:
361361
:meth:`IMAP4.send`, and :meth:`IMAP4.shutdown` methods. You may override
362362
this method.
363363

364+
.. audit-event:: imaplib.IMAP4.open "self host port"
365+
364366

365367
.. method:: IMAP4.partial(message_num, message_part, start, length)
366368

@@ -430,6 +432,8 @@ An :class:`IMAP4` instance has the following methods:
430432

431433
Sends ``data`` to the remote server. You may override this method.
432434

435+
.. audit-event:: imaplib.IMAP4.send "self data"
436+
433437

434438
.. method:: IMAP4.setacl(mailbox, who, what)
435439

Doc/library/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ High-level Module Interface
122122

123123
.. audit-event:: open "path mode flags"
124124

< 179B /code>
125-
This function raises an :func:`auditing event <sys.audit>` ``open`` with
125+
This function raises an :ref:`auditing event <auditing>` ``open`` with
126126
arguments ``path``, ``mode`` and ``flags``. The ``mode`` and ``flags``
127127
arguments may have been modified or inferred from the original call.
128128

Doc/library/nntplib.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ The module itself defines the following classes:
7979
('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp.python.committers')
8080
>>>
8181

82+
.. audit-event:: nntplib.NNTP "self host port"
83+
84+
All commands will raise an :ref:`auditing event <auditing>`
85+
``nntplib.NNTP.putline`` with arguments ``self`` and ``line``,
86+
where ``line`` is the bytes about to be sent to the remote host.
8287

8388
.. versionchanged:: 3.2
8489
*usenetrc* is now ``False`` by default.
@@ -100,6 +105,12 @@ The module itself defines the following classes:
100105
STARTTLS as described below. However, some servers only support the
101106
former.
102107

108+
.. audit-event:: nntplib.NNTP "self host port"
109+
110+
All commands will raise an :ref:`auditing event <auditing>`
111+
``nntplib.NNTP.putline`` with arguments ``self`` and ``line``,
112+
where ``line`` is the bytes about to be sent to the remote host.
113+
103114
.. versionadded:: 3.2
104115

105116
.. versionchanged:: 3.4

Doc/library/os.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,8 @@ features:
18011801
This function can also support :ref:`specifying a file descriptor
18021802
<path_fd>`; the file descriptor must refer to a directory.
18031803

1804+
.. audit-event:: os.listdir path
1805+
18041806
.. note::
18051807
To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`.
18061808

@@ -2178,6 +2180,8 @@ features:
21782180
This function can also support :ref:`specifying a file descriptor
21792181
<path_fd>`; the file descriptor must refer to a directory.
21802182

2183+
.. audit-event:: os.scandir path
2184+
21812185
The :func:`scandir` iterator supports the :term:`context manager` protocol
21822186
and has the following method:
21832187

Doc/library/pdb.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ access further features, you have to do this yourself:
181181

182182
import pdb; pdb.Pdb(skip=['django.*']).set_trace()
183183

184+
.. audit-event:: pdb.Pdb
185+
184186
.. versionadded:: 3.1
185187
The *skip* argument.
186188

0 commit comments

Comments
 (0)
0