From 3ceba3feb141a657eee7a0392d2caa26ad9b607d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 3 Aug 2022 11:10:08 +0200 Subject: [PATCH] fix: Mark all attributes in a soft deleted object as soft deleted too. Bump misp-objects, deps. --- poetry.lock | 64 ++++++++++++++++++++++++---------------- pymisp/data/misp-objects | 2 +- pymisp/mispevent.py | 3 +- pyproject.toml | 8 ++--- 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0cbb0d6..879a6eb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -74,17 +74,17 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "attrs" -version = "21.4.0" +version = "22.1.0" description = "Classes Without Boilerplate" category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.5" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"] [[package]] name = "babel" @@ -541,7 +541,7 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "json5" -version = "0.9.8" +version = "0.9.9" description = "A Python implementation of the JSON5 data format." category = "dev" optional = false @@ -552,7 +552,7 @@ dev = ["hypothesis"] [[package]] name = "jsonschema" -version = "4.7.2" +version = "4.9.1" description = "An implementation of JSON Schema validation for Python" category = "main" optional = false @@ -562,6 +562,7 @@ python-versions = ">=3.7" attrs = ">=17.4.0" importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} importlib-resources = {version = ">=1.4.0", markers = "python_version < \"3.9\""} +pkgutil-resolve-name = {version = ">=1.3.10", markers = "python_version < \"3.9\""} pyrsistent = ">=0.14.0,<0.17.0 || >0.17.0,<0.17.1 || >0.17.1,<0.17.2 || >0.17.2" typing-extensions = {version = "*", markers = "python_version < \"3.8\""} @@ -1027,6 +1028,14 @@ python-versions = ">=3.7" docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-issues (>=3.0.1)", "sphinx-removed-in", "sphinxext-opengraph"] tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] +[[package]] +name = "pkgutil-resolve-name" +version = "1.3.10" +description = "Resolve a name to an object." +category = "main" +optional = false +python-versions = ">=3.6" + [[package]] name = "pluggy" version = "1.0.0" @@ -1411,7 +1420,7 @@ test = ["pytest (>=4.6)", "html5lib", "cython", "typed-ast"] [[package]] name = "sphinx-autodoc-typehints" -version = "1.18.3" +version = "1.19.1" description = "Type hints (PEP 484) support for the Sphinx autodoc extension" category = "main" optional = true @@ -1611,7 +1620,7 @@ python-versions = "*" [[package]] name = "types-redis" -version = "4.3.11" +version = "4.3.13" description = "Typing stubs for redis" category = "dev" optional = false @@ -1619,7 +1628,7 @@ python-versions = "*" [[package]] name = "types-requests" -version = "2.28.5" +version = "2.28.7" description = "Typing stubs for requests" category = "dev" optional = false @@ -1630,7 +1639,7 @@ types-urllib3 = "<1.27" [[package]] name = "types-urllib3" -version = "1.26.17" +version = "1.26.21" description = "Typing stubs for urllib3" category = "dev" optional = false @@ -1778,7 +1787,7 @@ virustotal = ["validators"] [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "26933b7a8e151f8efd56ac0becd9d0ba2b29be3224d40dfbe7dc8d321978315e" +content-hash = "470f0f4666d7b19a17170e0afe70e0cc7b6a9f3d3289a15886a8272a89fb81b2" [metadata.files] alabaster = [ @@ -1824,8 +1833,8 @@ atomicwrites = [ {file = "atomicwrites-1.4.1.tar.gz", hash = "sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"}, ] attrs = [ - {file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"}, - {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, + {file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"}, + {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, ] babel = [ {file = "Babel-2.10.3-py3-none-any.whl", hash = "sha256:ff56f4892c1c4bf0d814575ea23471c230d544203c7748e8c68f0089478d48eb"}, @@ -2191,11 +2200,12 @@ jinja2 = [ {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, ] json5 = [ - {file = "json5-0.9.8.tar.gz", hash = "sha256:0fa6e4d3ef062f93ba9cf2a9103fe8e68c7917dfa33519ae3ac8c7e48e3c84ff"}, + {file = "json5-0.9.9-py2.py3-none-any.whl", hash = "sha256:1ff8351ee2ae80fd89d64210d9522db7e157516a7b12c72089ded6964527283f"}, + {file = "json5-0.9.9.tar.gz", hash = "sha256:2ace77117c068c5f1f23f97e530a0d49bc09a46039521b6daa74aa39524e02a2"}, ] jsonschema = [ - {file = "jsonschema-4.7.2-py3-none-any.whl", hash = "sha256:c7448a421b25e424fccfceea86b4e3a8672b4436e1988ccbde92c80828d4f085"}, - {file = "jsonschema-4.7.2.tar.gz", hash = "sha256:73764f461d61eb97a057c929368610a134d1d1fffd858acfe88864ee94f1f1d3"}, + {file = "jsonschema-4.9.1-py3-none-any.whl", hash = "sha256:8ebad55894c002585271af2d327d99339ef566fb085d9129b69e2623867c4106"}, + {file = "jsonschema-4.9.1.tar.gz", hash = "sha256:408c4c8ed0dede3b268f7a441784f74206380b04f93eb2d537c7befb3df3099f"}, ] jupyter-client = [ {file = "jupyter_client-7.3.4-py3-none-any.whl", hash = "sha256:17d74b0d0a7b24f1c8c527b24fcf4607c56bee542ffe8e3418e50b21e514b621"}, @@ -2453,6 +2463,10 @@ pillow = [ {file = "Pillow-9.2.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:0030fdbd926fb85844b8b92e2f9449ba89607231d3dd597a21ae72dc7fe26927"}, {file = "Pillow-9.2.0.tar.gz", hash = "sha256:75e636fd3e0fb872693f23ccb8a5ff2cd578801251f3a4f6854c6a5d437d3c04"}, ] +pkgutil-resolve-name = [ + {file = "pkgutil_resolve_name-1.3.10-py3-none-any.whl", hash = "sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e"}, + {file = "pkgutil_resolve_name-1.3.10.tar.gz", hash = "sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174"}, +] pluggy = [ {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, @@ -2748,8 +2762,8 @@ sphinx = [ {file = "Sphinx-5.1.1.tar.gz", hash = "sha256:ba3224a4e206e1fbdecf98a4fae4992ef9b24b85ebf7b584bb340156eaf08d89"}, ] sphinx-autodoc-typehints = [ - {file = "sphinx_autodoc_typehints-1.18.3-py3-none-any.whl", hash = "sha256:20294de2a818bda04953c5cb302ec5af46138c81980ad9efa6d8fc1fc4242518"}, - {file = "sphinx_autodoc_typehints-1.18.3.tar.gz", hash = "sha256:c04d8f8d70e988960e25b206af39a90df84e7e2c085bb24e123bc3684021b313"}, + {file = "sphinx_autodoc_typehints-1.19.1-py3-none-any.whl", hash = "sha256:9be46aeeb1b315eb5df1f3a7cb262149895d16c7d7dcd77b92513c3c3a1e85e6"}, + {file = "sphinx_autodoc_typehints-1.19.1.tar.gz", hash = "sha256:6c841db55e0e9be0483ff3962a2152b60e79306f4288d8c4e7e86ac84486a5ea"}, ] sphinxcontrib-applehelp = [ {file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"}, @@ -2851,16 +2865,16 @@ types-python-dateutil = [ {file = "types_python_dateutil-2.8.19-py3-none-any.whl", hash = "sha256:6284df1e4783d8fc6e587f0317a81333856b872a6669a282f8a325342bce7fa8"}, ] types-redis = [ - {file = "types-redis-4.3.11.tar.gz", hash = "sha256:83e5633f216c729fb39c5d3f71dd3b0080c651f75b5d4128733878512409c744"}, - {file = "types_redis-4.3.11-py3-none-any.whl", hash = "sha256:ba4612407a758353aa4fe5e1e4b804126e1160dbd6797840223958b1b5dda34d"}, + {file = "types-redis-4.3.13.tar.gz", hash = "sha256:b8334a96a2f431521bfa72205b343129acdc5a646ffcfb304d80a1cd0deff548"}, + {file = "types_redis-4.3.13-py3-none-any.whl", hash = "sha256:cc2209ecfab2ad6df1e3eec730c06f9b2dec77f4164eb86e04dad455a651b394"}, ] types-requests = [ - {file = "types-requests-2.28.5.tar.gz", hash = "sha256:ac618bfefcb3742eaf97c961e13e9e5a226e545eda4a3dbe293b898d40933ad1"}, - {file = "types_requests-2.28.5-py3-none-any.whl", hash = "sha256:98ab647ae88b5e2c41d6d20cfcb5117da1bea561110000b6fdeeea07b3e89877"}, + {file = "types-requests-2.28.7.tar.gz", hash = "sha256:36385618d4bd2ee3211d4d2e78b44f067ceb5984865c0f253f3c9ecb964526cf"}, + {file = "types_requests-2.28.7-py3-none-any.whl", hash = "sha256:38015d310d13cf7d4d712d2507178349e13fd5dab85259dab7d9a9884c2c9c2a"}, ] types-urllib3 = [ - {file = "types-urllib3-1.26.17.tar.gz", hash = "sha256:73fd274524c3fc7cd8cd9ceb0cb67ed99b45f9cb2831013e46d50c1451044800"}, - {file = "types_urllib3-1.26.17-py3-none-any.whl", hash = "sha256:0d027fcd27dbb3cb532453b4d977e05bc1e13aefd70519866af211b3003d895d"}, + {file = "types-urllib3-1.26.21.tar.gz", hash = "sha256:2f7fb7ae6a1884241e588c7becd5f005ce1e03f6eface8a3f65e378c2adf9516"}, + {file = "types_urllib3-1.26.21-py3-none-any.whl", hash = "sha256:2f960d8681002a37385263c372882fd12c676e10b127553738a2b6064e4438d1"}, ] types-werkzeug = [ {file = "types-Werkzeug-1.0.9.tar.gz", hash = "sha256:5cc269604c400133d452a40cee6397655f878fc460e03fde291b9e3a5eaa518c"}, diff --git a/pymisp/data/misp-objects b/pymisp/data/misp-objects index 50f61a0..ec00217 160000 --- a/pymisp/data/misp-objects +++ b/pymisp/data/misp-objects @@ -1 +1 @@ -Subproject commit 50f61a03beb9aac4256a82348b5cb2f4ed6d1932 +Subproject commit ec00217098c20cdbb801fed3a785b0e80649cbc1 diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index bd18d26..2d5c4de 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -796,7 +796,7 @@ class MISPObject(AbstractMISP): if not hasattr(self, 'template_uuid'): # workaround for old events where the template_uuid was not yet mandatory self.template_uuid = str(uuid.uuid5(uuid.UUID("9319371e-2504-4128-8410-3741cebbcfd3"), self.name)) if not hasattr(self, 'description'): # workaround for old events where description is not always set - self.description='' + self.description = '' if not hasattr(self, 'meta-category'): # workaround for old events where meta-category is not always set setattr(self, 'meta-category', 'misc') to_return = super(MISPObject, self)._to_feed() @@ -849,6 +849,7 @@ class MISPObject(AbstractMISP): def delete(self): """Mark the object as deleted (soft delete)""" self.deleted = True + [a.delete() for a in self.attributes] @property def disable_validation(self): diff --git a/pyproject.toml b/pyproject.toml index 3b6fd00..2cb1ed3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ include = [ python = "^3.7" requests = "^2.28.1" python-dateutil = "^2.8.2" -jsonschema = "^4.7.2" +jsonschema = "^4.9.0" deprecated = "^1.2.13" extract_msg = {version = "^0.36.1", optional = true} RTFDE = {version = "^0.0.2", optional = true} @@ -54,7 +54,7 @@ pydeep2 = {version = "^0.5.1", optional = true} lief = {version = "^0.12.1", optional = true} beautifulsoup4 = {version = "^4.11.1", optional = true} validators = {version = "^0.20.0", optional = true} -sphinx-autodoc-typehints = {version = "^1.18.3", optional = true} +sphinx-autodoc-typehints = {version = "^1.19.1", optional = true} recommonmark = {version = "^0.7.1", optional = true} reportlab = {version = "^3.6.11", optional = true} pyfaup = {version = "^1.2", optional = true} @@ -77,9 +77,9 @@ requests-mock = "^1.9.3" mypy = "^0.971" ipython = "^7.34.0" jupyterlab = "^3.4.4" -types-requests = "^2.28.5" +types-requests = "^2.28.6" types-python-dateutil = "^2.8.19" -types-redis = "^4.3.11" +types-redis = "^4.3.12" types-Flask = "^1.1.6" pytest-cov = "^3.0.0"