RestrictedPython 7.2__py3-none-any.whl → 7.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- RestrictedPython/Guards.py +5 -0
- RestrictedPython/Utilities.py +5 -1
- {RestrictedPython-7.2.dist-info → RestrictedPython-7.3.dist-info}/METADATA +12 -1
- {RestrictedPython-7.2.dist-info → RestrictedPython-7.3.dist-info}/RECORD +7 -7
- {RestrictedPython-7.2.dist-info → RestrictedPython-7.3.dist-info}/LICENSE.txt +0 -0
- {RestrictedPython-7.2.dist-info → RestrictedPython-7.3.dist-info}/WHEEL +0 -0
- {RestrictedPython-7.2.dist-info → RestrictedPython-7.3.dist-info}/top_level.txt +0 -0
RestrictedPython/Guards.py
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import builtins
|
|
19
19
|
|
|
20
20
|
from RestrictedPython._compat import IS_PY311_OR_GREATER
|
|
21
|
+
from RestrictedPython.transformer import INSPECT_ATTRIBUTES
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
safe_builtins = {}
|
|
@@ -253,6 +254,10 @@ def safer_getattr(object, name, default=None, getattr=getattr):
|
|
|
253
254
|
(isinstance(object, type) and issubclass(object, str))):
|
|
254
255
|
raise NotImplementedError(
|
|
255
256
|
'Using the format*() methods of `str` is not safe')
|
|
257
|
+
if name in INSPECT_ATTRIBUTES:
|
|
258
|
+
raise AttributeError(
|
|
259
|
+
f'"{name}" is a restricted name,'
|
|
260
|
+
' that is forbidden to access in RestrictedPython.')
|
|
256
261
|
if name.startswith('_'):
|
|
257
262
|
raise AttributeError(
|
|
258
263
|
'"{name}" is an invalid attribute name because it '
|
RestrictedPython/Utilities.py
CHANGED
|
@@ -29,7 +29,11 @@ class _AttributeDelegator:
|
|
|
29
29
|
if attr in self.__excludes:
|
|
30
30
|
raise NotImplementedError(
|
|
31
31
|
f"{self.__mod.__name__}.{attr} is not safe")
|
|
32
|
-
|
|
32
|
+
try:
|
|
33
|
+
return getattr(self.__mod, attr)
|
|
34
|
+
except AttributeError as e:
|
|
35
|
+
e.obj = self
|
|
36
|
+
raise
|
|
33
37
|
|
|
34
38
|
|
|
35
39
|
utility_builtins['string'] = _AttributeDelegator(string, "Formatter")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RestrictedPython
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.3
|
|
4
4
|
Summary: RestrictedPython is a defined subset of the Python language which allows to provide a program input into a trusted environment.
|
|
5
5
|
Home-page: https://github.com/zopefoundation/RestrictedPython
|
|
6
6
|
Author: Zope Foundation and Contributors
|
|
@@ -124,6 +124,17 @@ the documentation `Contributing page
|
|
|
124
124
|
Changes
|
|
125
125
|
=======
|
|
126
126
|
|
|
127
|
+
7.3 (2024-09-30)
|
|
128
|
+
----------------
|
|
129
|
+
|
|
130
|
+
- Increase the safety level of ``safer_getattr`` allowing applications to use
|
|
131
|
+
it as ``getattr`` implementation. Such use should now follow the same policy
|
|
132
|
+
and give the same level of protection as direct attribute access in an
|
|
133
|
+
environment based on ``RestrictedPython``'s ``safe_builtints``.
|
|
134
|
+
- Prevent information leakage via ``AttributeError.obj``
|
|
135
|
+
and the ``string`` module.
|
|
136
|
+
|
|
137
|
+
|
|
127
138
|
7.2 (2024-08-02)
|
|
128
139
|
----------------
|
|
129
140
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
RestrictedPython/Eval.py,sha256=pa79tc-JsT7xfzwg0ceMkxyioIEnFbNHc_PsKUhkkj8,3201
|
|
2
|
-
RestrictedPython/Guards.py,sha256=
|
|
2
|
+
RestrictedPython/Guards.py,sha256=YV-gxQZoXXzr7pLF3ovpVdVmKgsQ4LVcET6T-dHEMns,7962
|
|
3
3
|
RestrictedPython/Limits.py,sha256=dORpuly21vSjy8gzNac9IYfIXMMWRVFvqUiKKIeZ3OM,1866
|
|
4
4
|
RestrictedPython/PrintCollector.py,sha256=bBCpnUPOuKz1wJDuSgh7wo2aoKfcTJeeT8OYnM-K9F8,1137
|
|
5
|
-
RestrictedPython/Utilities.py,sha256=
|
|
5
|
+
RestrictedPython/Utilities.py,sha256=u4HUdyjGawaeHyXSakyt4gRT17BZietXnF5WqicujjE,3033
|
|
6
6
|
RestrictedPython/__init__.py,sha256=qB_s6zDxuXPAGMoKYKBMc-xZ0gTnQ0ZvtY5FxdAG3aM,1862
|
|
7
7
|
RestrictedPython/_compat.py,sha256=nacdAJi4E8GKhkR99_BAxMA0AtK2FQnvrqZbG8hGofc,383
|
|
8
8
|
RestrictedPython/compile.py,sha256=IhcF733t-bkPcvfQ2_NyBeCbSIPtHYxR-GQNNHnaMHM,6727
|
|
9
9
|
RestrictedPython/transformer.py,sha256=toPGqFvc9WM1bnh2yIgNZcsz0ySwlSyJXViCSau-19I,42906
|
|
10
|
-
RestrictedPython-7.
|
|
11
|
-
RestrictedPython-7.
|
|
12
|
-
RestrictedPython-7.
|
|
13
|
-
RestrictedPython-7.
|
|
14
|
-
RestrictedPython-7.
|
|
10
|
+
RestrictedPython-7.3.dist-info/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070
|
|
11
|
+
RestrictedPython-7.3.dist-info/METADATA,sha256=J-IFLeEBGFCNsFn1FitgU1b_fA_dzSV1BfLiuicqLlI,12981
|
|
12
|
+
RestrictedPython-7.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
13
|
+
RestrictedPython-7.3.dist-info/top_level.txt,sha256=E1-3ARWcduVJnQAScms0FgqnBx_PovrzYsNMYuLGwa0,17
|
|
14
|
+
RestrictedPython-7.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|