Skip to content

Commit 091cd79

Browse files
committed
feedback
1 parent afa6a05 commit 091cd79

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Doc/library/annotationlib.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ and :func:`call_annotate_function`, as well as the
4545
:func:`call_evaluate_function` function for working with
4646
:term:`evaluate functions <evaluate function>`.
4747

48-
.. warning::
48+
.. caution::
4949

5050
Most functionality in this module can execute arbitrary code; see
5151
:ref:`the security section <annotationlib-security>` for more information.
@@ -610,18 +610,19 @@ Below are a few examples of the behavior with unsupported expressions:
610610
611611
.. _annotationlib-security:
612612

613-
Security
614-
--------
613+
Security implications of introspecting annotations
614+
--------------------------------------------------
615615

616-
Much of the functionality in this module involves executing arbitrary code. For example,
616+
Much of the functionality in this module involves executing code related to annotations,
617+
which can then do arbitrary things. For example,
617618
:func:`get_annotations` may call an arbitrary :term:`annotate function`, and
618619
:meth:`ForwardRef.evaluate` may call :func:`eval` on an arbitrary string. Code contained
619620
in an annotation might make arbitrary system calls, enter an infinite loop, or perform any
620-
other operation. This is also true for access to the :attr:`~object.__annotations__` attribute,
621+
other operation. This is also true for any access of the :attr:`~object.__annotations__` attribute,
621622
and for various functions in the :mod:`typing` module that work with annotations, such as
622623
:func:`typing.get_type_hints`.
623624

624-
Any security issues arising from these facts also apply immediately after importing
625+
Any security issue arising from this also applies immediately after importing
625626
code that may contain untrusted annotations: importing code can always cause arbitrary operations
626627
to be performed. However, it is unsafe to accept strings or other input from an untrusted source and
627628
pass them to any of the APIs for introspecting annotations, for example by editing an

Doc/library/inspect.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ Classes and functions
12891289
This is an alias for :func:`annotationlib.get_annotations`; see the documentation
12901290
of that function for more information.
12911291

1292-
.. warning::
1292+
.. caution::
12931293

12941294
This function may execute arbitrary code contained in annotations.
12951295
See :ref:`annotationlib-security` for more information.

Doc/library/typing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3367,7 +3367,7 @@ Introspection helpers
33673367
See also :func:`annotationlib.get_annotations`, a lower-level function that
33683368
returns annotations more directly.
33693369

3370-
.. warning::
3370+
.. caution::
33713371

33723372
This function may execute arbitrary code contained in annotations.
33733373
See :ref:`annotationlib-security` for more information.
@@ -3518,7 +3518,7 @@ Introspection helpers
35183518
See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for
35193519
the meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* parameters.
35203520

3521-
.. warning::
3521+
.. caution::
35223522

35233523
This function may execute arbitrary code contained in annotations.
35243524
See :ref:`annotationlib-security` for more information.

0 commit comments

Comments
 (0)