GeezerVison is showing github.com — Merge commit from fork · patchwright/deepdiff@60ac5b9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .bumpversion.cfg +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | [bumpversion] | 2 | | -current_version = 8.6.0 | | 2 | +current_version = 8.6.1 | 3 | 3 | commit = True | 4 | 4 | tag = True | 5 | 5 | tag_name = {new_version} | |
Collapse file Copy file name to clipboardExpand all lines: AUTHORS.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -75,3 +75,4 @@ Authors in order of the timeline of their contributions: | 75 | 75 | - [dtorres-sf](https://github.com/dtorres-sf) for the fix for moving nested tables when using iterable_compare_func. | 76 | 76 | - [Jim Cipar](https://github.com/jcipar) for the fix recursion depth limit when hashing numpy.datetime64 | 77 | 77 | - [Enji Cooper](https://github.com/ngie-eign) for converting legacy setuptools use to pyproject.toml | | 78 | +- [Diogo Correia](https://github.com/diogotcorreia) for reporting security vulnerability in Delta and DeepDiff that could allow remote code execution. |
Collapse file Copy file name to clipboardExpand all lines: CHANGELOG.md +4Lines changed: 4 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # DeepDiff Change log | 2 | 2 |
| | 3 | +- v8-6-1 | | 4 | + - Patched security vulnerability in the Delta class which was vulnerable to class pollution via its constructor, and when combined with a gadget available in DeltaDiff itself, it could lead to Denial of Service and Remote Code Execution (via insecure Pickle deserialization). | | 5 | + | | 6 | + | 3 | 7 | - v8-6-0 | 4 | 8 | - Added Colored View thanks to @mauvilsa | 5 | 9 | - Added support for applying deltas to NamedTuple thanks to @paulsc | |
Collapse file Copy file name to clipboardExpand all lines: CITATION.cff +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | given-names: "Sep" | 6 | 6 | orcid: "https://orcid.org/0009-0009-5828-4345" | 7 | 7 | title: "DeepDiff" | 8 | | -version: 8.6.0 | | 8 | +version: 8.6.1 | 9 | 9 | date-released: 2024 | 10 | 10 | url: "https://github.com/seperman/deepdiff" |
Collapse file Copy file name to clipboardExpand all lines: README.md +5-2Lines changed: 5 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -# DeepDiff v 8.6.0 | | 1 | +# DeepDiff v 8.6.1 | 2 | 2 |
| 3 | 3 |  | 4 | 4 |  | | 17 | 17 |
| 18 | 18 | Tested on Python 3.9+ and PyPy3. | 19 | 19 |
| 20 | | -- **[Documentation](https://zepworks.com/deepdiff/8.6.0/)** | | 20 | +- **[Documentation](https://zepworks.com/deepdiff/8.6.1/)** | 21 | 21 |
| 22 | 22 | ## What is new? | 23 | 23 |
| 24 | 24 | Please check the [ChangeLog](CHANGELOG.md) file for the detailed information. | 25 | 25 |
| | 26 | +DeepDiff 8-6-1 | | 27 | +- Patched security vulnerability in the Delta class which was vulnerable to class pollution via its constructor, and when combined with a gadget available in DeltaDiff itself, it could lead to Denial of Service and Remote Code Execution (via insecure Pickle deserialization). | | 28 | + | 26 | 29 | DeepDiff 8-6-0 | 27 | 30 |
| 28 | 31 | - Added Colored View thanks to @mauvilsa | |
Collapse file Copy file name to clipboardExpand all lines: deepdiff/__init__.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | """This module offers the DeepDiff, DeepSearch, grep, Delta and DeepHash classes.""" | 2 | 2 | # flake8: noqa | 3 | | -__version__ = '8.6.0' | | 3 | +__version__ = '8.6.1' | 4 | 4 | import logging | 5 | 5 |
| 6 | 6 | if __name__ == '__main__': | |
Collapse file Copy file name to clipboardExpand all lines: deepdiff/delta.py +7-1Lines changed: 7 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | ) | 18 | 18 | from deepdiff.path import ( | 19 | 19 | _path_to_elements, _get_nested_obj, _get_nested_obj_and_force, | 20 | | - GET, GETATTR, parse_path, stringify_path, | | 20 | + GET, GETATTR, check_elem, parse_path, stringify_path, | 21 | 21 | ) | 22 | 22 | from deepdiff.anyset import AnySet | 23 | 23 | from deepdiff.summarize import summarize | @@ -237,6 +237,11 @@ def _get_elem_and_compare_to_old_value( | 237 | 237 | forced_old_value=None, | 238 | 238 | next_element=None, | 239 | 239 | ): | | 240 | + try: | | 241 | + check_elem(elem) | | 242 | + except ValueError as error: | | 243 | + self._raise_or_log(UNABLE_TO_GET_ITEM_MSG.format(path_for_err_reporting, error)) | | 244 | + return not_found | 240 | 245 | # if forced_old_value is not None: | 241 | 246 | try: | 242 | 247 | if action == GET: | @@ -536,6 +541,7 @@ def _get_elements_and_details(self, path): | 536 | 541 | obj = self | 537 | 542 | # obj = self.get_nested_obj(obj=self, elements=elements[:-1]) | 538 | 543 | elem, action = elements[-1] # type: ignore | | 544 | + check_elem(elem) | 539 | 545 | except Exception as e: | 540 | 546 | self._raise_or_log(UNABLE_TO_GET_ITEM_MSG.format(path, e)) | 541 | 547 | return None | |
Collapse file Copy file name to clipboardExpand all lines: deepdiff/path.py +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -117,6 +117,7 @@ def _path_to_elements(path, root_element=DEFAULT_FIRST_ELEMENT): | 117 | 117 |
| 118 | 118 | def _get_nested_obj(obj, elements, next_element=None): | 119 | 119 | for (elem, action) in elements: | | 120 | + check_elem(elem) | 120 | 121 | if action == GET: | 121 | 122 | obj = obj[elem] | 122 | 123 | elif action == GETATTR: | @@ -134,11 +135,17 @@ def _guess_type(elements, elem, index, next_element): | 134 | 135 | return {} | 135 | 136 |
| 136 | 137 |
| | 138 | +def check_elem(elem): | | 139 | + if isinstance(elem, str) and elem.startswith("__") and elem.endswith("__"): | | 140 | + raise ValueError("traversing dunder attributes is not allowed") | | 141 | + | | 142 | + | 137 | 143 | def _get_nested_obj_and_force(obj, elements, next_element=None): | 138 | 144 | prev_elem = None | 139 | 145 | prev_action = None | 140 | 146 | prev_obj = obj | 141 | 147 | for index, (elem, action) in enumerate(elements): | | 148 | + check_elem(elem) | 142 | 149 | _prev_obj = obj | 143 | 150 | if action == GET: | 144 | 151 | try: | |
Collapse file Copy file name to clipboardExpand all lines: deepdiff/serialization.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -59,7 +59,7 @@ class UnsupportedFormatErr(TypeError): | 59 | 59 | DELTA_IGNORE_ORDER_NEEDS_REPETITION_REPORT = 'report_repetition must be set to True when ignore_order is True to create the delta object.' | 60 | 60 | DELTA_ERROR_WHEN_GROUP_BY = 'Delta can not be made when group_by is used since the structure of data is modified from the original form.' | 61 | 61 |
| 62 | | -SAFE_TO_IMPORT = { | | 62 | +SAFE_TO_IMPORT = frozenset({ | 63 | 63 | 'builtins.range', | 64 | 64 | 'builtins.complex', | 65 | 65 | 'builtins.set', | @@ -95,7 +95,7 @@ class UnsupportedFormatErr(TypeError): | 95 | 95 | 'ipaddress.IPv4Address', | 96 | 96 | 'ipaddress.IPv6Address', | 97 | 97 | 'collections.abc.KeysView', | 98 | | -} | | 98 | +}) | 99 | 99 |
| 100 | 100 |
| 101 | 101 | TYPE_STR_TO_TYPE = { | |
Collapse file Copy file name to clipboardExpand all lines: docs/authors.rst +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -117,6 +117,7 @@ and polars support. | 117 | 117 | limit when hashing numpy.datetime64 | 118 | 118 | - `Enji Cooper <https://github.com/ngie-eign>`__ for converting legacy | 119 | 119 | setuptools use to pyproject.toml | | 120 | +- `Diogo Correia <https://github.com/diogotcorreia>`__ for reporting security vulnerability in Delta and DeepDiff that could allow remote code execution. | 120 | 121 |
| 121 | 122 |
| 122 | 123 | .. _Sep Dehpour (Seperman): http://www.zepworks.com | |
|