RestrictedPython 7.2a1.dev0__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 +7 -0
- RestrictedPython/Utilities.py +5 -1
- RestrictedPython/transformer.py +4 -0
- {RestrictedPython-7.2a1.dev0.dist-info → RestrictedPython-7.3.dist-info}/METADATA +20 -6
- RestrictedPython-7.3.dist-info/RECORD +14 -0
- RestrictedPython-7.2a1.dev0.dist-info/RECORD +0 -14
- {RestrictedPython-7.2a1.dev0.dist-info → RestrictedPython-7.3.dist-info}/LICENSE.txt +0 -0
- {RestrictedPython-7.2a1.dev0.dist-info → RestrictedPython-7.3.dist-info}/WHEEL +0 -0
- {RestrictedPython-7.2a1.dev0.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 = {}
|
|
@@ -246,11 +247,17 @@ def safer_getattr(object, name, default=None, getattr=getattr):
|
|
|
246
247
|
http://lucumr.pocoo.org/2016/12/29/careful-with-str-format/
|
|
247
248
|
|
|
248
249
|
"""
|
|
250
|
+
if type(name) is not str:
|
|
251
|
+
raise TypeError('type(name) must be str')
|
|
249
252
|
if name in ('format', 'format_map') and (
|
|
250
253
|
isinstance(object, str) or
|
|
251
254
|
(isinstance(object, type) and issubclass(object, str))):
|
|
252
255
|
raise NotImplementedError(
|
|
253
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.')
|
|
254
261
|
if name.startswith('_'):
|
|
255
262
|
raise AttributeError(
|
|
256
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")
|
RestrictedPython/transformer.py
CHANGED
|
@@ -593,6 +593,10 @@ class RestrictingNodeTransformer(ast.NodeTransformer):
|
|
|
593
593
|
"""
|
|
594
594
|
return self.node_contents_visit(node)
|
|
595
595
|
|
|
596
|
+
def visit_Interactive(self, node):
|
|
597
|
+
"""Allow single mode without restrictions."""
|
|
598
|
+
return self.node_contents_visit(node)
|
|
599
|
+
|
|
596
600
|
def visit_List(self, node):
|
|
597
601
|
"""Allow list literals without restrictions."""
|
|
598
602
|
return self.node_contents_visit(node)
|
|
@@ -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
|
|
@@ -23,7 +23,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
24
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
25
|
Classifier: Topic :: Security
|
|
26
|
-
Requires-Python: >=3.7, <3.
|
|
26
|
+
Requires-Python: >=3.7, <3.13
|
|
27
27
|
Description-Content-Type: text/x-rst
|
|
28
28
|
License-File: LICENSE.txt
|
|
29
29
|
Provides-Extra: docs
|
|
@@ -124,11 +124,25 @@ the documentation `Contributing page
|
|
|
124
124
|
Changes
|
|
125
125
|
=======
|
|
126
126
|
|
|
127
|
-
7.
|
|
128
|
-
|
|
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
|
+
|
|
138
|
+
7.2 (2024-08-02)
|
|
139
|
+
----------------
|
|
129
140
|
|
|
130
|
-
-
|
|
131
|
-
|
|
141
|
+
- Remove unneeded setuptools fossils that may cause installation problems
|
|
142
|
+
with recent setuptools versions.
|
|
143
|
+
- Add support for single mode statements / execution.
|
|
144
|
+
- Fix a potential breakout capability in the provided ``safer_getattr`` method
|
|
145
|
+
that is part of the ``safer_builtins``.
|
|
132
146
|
|
|
133
147
|
|
|
134
148
|
7.1 (2024-03-14)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
RestrictedPython/Eval.py,sha256=pa79tc-JsT7xfzwg0ceMkxyioIEnFbNHc_PsKUhkkj8,3201
|
|
2
|
+
RestrictedPython/Guards.py,sha256=YV-gxQZoXXzr7pLF3ovpVdVmKgsQ4LVcET6T-dHEMns,7962
|
|
3
|
+
RestrictedPython/Limits.py,sha256=dORpuly21vSjy8gzNac9IYfIXMMWRVFvqUiKKIeZ3OM,1866
|
|
4
|
+
RestrictedPython/PrintCollector.py,sha256=bBCpnUPOuKz1wJDuSgh7wo2aoKfcTJeeT8OYnM-K9F8,1137
|
|
5
|
+
RestrictedPython/Utilities.py,sha256=u4HUdyjGawaeHyXSakyt4gRT17BZietXnF5WqicujjE,3033
|
|
6
|
+
RestrictedPython/__init__.py,sha256=qB_s6zDxuXPAGMoKYKBMc-xZ0gTnQ0ZvtY5FxdAG3aM,1862
|
|
7
|
+
RestrictedPython/_compat.py,sha256=nacdAJi4E8GKhkR99_BAxMA0AtK2FQnvrqZbG8hGofc,383
|
|
8
|
+
RestrictedPython/compile.py,sha256=IhcF733t-bkPcvfQ2_NyBeCbSIPtHYxR-GQNNHnaMHM,6727
|
|
9
|
+
RestrictedPython/transformer.py,sha256=toPGqFvc9WM1bnh2yIgNZcsz0ySwlSyJXViCSau-19I,42906
|
|
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,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
RestrictedPython/Eval.py,sha256=pa79tc-JsT7xfzwg0ceMkxyioIEnFbNHc_PsKUhkkj8,3201
|
|
2
|
-
RestrictedPython/Guards.py,sha256=XXupE0TwcWdb6qAsSexWUYEIeT3bVLTdOVvn94eoqs0,7646
|
|
3
|
-
RestrictedPython/Limits.py,sha256=dORpuly21vSjy8gzNac9IYfIXMMWRVFvqUiKKIeZ3OM,1866
|
|
4
|
-
RestrictedPython/PrintCollector.py,sha256=bBCpnUPOuKz1wJDuSgh7wo2aoKfcTJeeT8OYnM-K9F8,1137
|
|
5
|
-
RestrictedPython/Utilities.py,sha256=7R6Op1Oqw9-fSxy_eWVa6ioZPx-SAxa7OolDObTWRkU,2937
|
|
6
|
-
RestrictedPython/__init__.py,sha256=qB_s6zDxuXPAGMoKYKBMc-xZ0gTnQ0ZvtY5FxdAG3aM,1862
|
|
7
|
-
RestrictedPython/_compat.py,sha256=nacdAJi4E8GKhkR99_BAxMA0AtK2FQnvrqZbG8hGofc,383
|
|
8
|
-
RestrictedPython/compile.py,sha256=IhcF733t-bkPcvfQ2_NyBeCbSIPtHYxR-GQNNHnaMHM,6727
|
|
9
|
-
RestrictedPython/transformer.py,sha256=AsPDuEN42OrBZBDtDCOFcWssNZrvm8PBGku8IvREXFg,42766
|
|
10
|
-
RestrictedPython-7.2a1.dev0.dist-info/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070
|
|
11
|
-
RestrictedPython-7.2a1.dev0.dist-info/METADATA,sha256=V23yHfhhH7oSZr2ClO4fp6hkl0XVT5Xr1bveMPANdfw,12397
|
|
12
|
-
RestrictedPython-7.2a1.dev0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
13
|
-
RestrictedPython-7.2a1.dev0.dist-info/top_level.txt,sha256=E1-3ARWcduVJnQAScms0FgqnBx_PovrzYsNMYuLGwa0,17
|
|
14
|
-
RestrictedPython-7.2a1.dev0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|