From 2662b50ac7d2f32238afbccaaaedbb1961647b53 Mon Sep 17 00:00:00 2001 From: "Jiawei \"Tyler\" Gu" <47795840+tylergu@users.noreply.github.com> Date: Sun, 13 Oct 2024 20:57:07 -0500 Subject: [PATCH] Update versions to fix security alerts (#396) * Update versions to fix security alerts Signed-off-by: Tyler Gu * Fix ArraySchema's deletion test Signed-off-by: Tyler Gu --------- Signed-off-by: Tyler Gu --- acto/schema/array.py | 8 +-- pyproject.toml | 45 +++++++------ requirements-dev.txt | 66 ++++++------------- requirements.txt | 31 ++++----- test/integration_tests/test_semantic_tests.py | 8 ++- 5 files changed, 68 insertions(+), 90 deletions(-) diff --git a/acto/schema/array.py b/acto/schema/array.py index 2595e7c661..16acb37d36 100644 --- a/acto/schema/array.py +++ b/acto/schema/array.py @@ -127,6 +127,10 @@ def gen(self, exclude_value=None, minimum: bool = False, **kwargs) -> list: num = 0 if "size" in kwargs and kwargs["size"] is not None: num = kwargs["size"] + elif minimum: + num = self.min_items + else: + num = random.randint(self.min_items, self.max_items) if self.enum is not None: if exclude_value is not None: @@ -145,10 +149,6 @@ def gen(self, exclude_value=None, minimum: bool = False, **kwargs) -> list: # XXX: need to handle exclude_value, but not important for now for array types result = [] - if minimum: - num = self.min_items - else: - num = random.randint(self.min_items, self.max_items) for _ in range(num): result.append(self.item_schema.gen(minimum=minimum)) return result diff --git a/pyproject.toml b/pyproject.toml index 66e2ed2c6c..90537a7869 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,36 +6,39 @@ version = "0.1.0" readme = "README.md" license = { file = "LICENSE" } dependencies = [ - "deepdiff~=6.3.0", - "kubernetes==26.1.0", - "exrex~=0.11.0", - "jsonschema~=4.17.3", - "jsonpatch~=1.33", - "pandas~=2.0.2", - "PyYAML~=6.0", - "ruamel.yaml~=0.18", - "requests~=2.31.0", - "pydantic~=2.5.2", - "pytest~=7.4.0", + "deepdiff", + "kubernetes==31.0.0", + "exrex", + "jsonschema", + "jsonpatch", + "pandas", + "PyYAML", + "ruamel.yaml", + "requests", + "pydantic", + "pytest", + "urllib3>=2.2.3", # security fix + "requests>=2.32.3", # security fix + "idna>=3.10", # security fix + "certifi>=2024.8.30", # security fix ] [project.optional-dependencies] dev = [ - "docker~=6.1.3", + "docker", "prometheus_client", - "pytest-cov~=4.1.0", - "tabulate~=0.9.0", - "pip-tools~=7.3.0", - "pre-commit~=3.6.0", - "ansible-core>=2.16.3", - "cryptography>=42.0.4", - "aiohttp>=3.9.2", - "jinja2>=3.1.3", + "pytest-cov", + "tabulate", + "pip-tools", + "pre-commit", + "ansible-core>=2.17.5", + "jinja2>=3.1.4", "isort", "mypy", - "black", + "black>=24.10.0", "pylint", "jsonref", + "cryptography>=43.0.1", # security fix ] [build-system] diff --git a/requirements-dev.txt b/requirements-dev.txt index 10b0c2542e..12a5600656 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,35 +1,26 @@ # -# This file is autogenerated by pip-compile with Python 3.10 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --extra=dev --output-file=requirements-dev.txt # -aiohttp==3.9.3 - # via - # acto (pyproject.toml) - # black -aiosignal==1.3.1 - # via aiohttp annotated-types==0.6.0 # via pydantic -ansible-core==2.16.3 +ansible-core==2.17.5 # via acto (pyproject.toml) astroid==3.0.2 # via pylint -async-timeout==4.0.3 - # via aiohttp attrs==23.1.0 - # via - # aiohttp - # jsonschema -black==23.12.0 + # via jsonschema +black==24.10.0 # via acto (pyproject.toml) build==1.0.3 # via pip-tools cachetools==5.3.2 # via google-auth -certifi==2023.11.17 +certifi==2024.8.30 # via + # acto (pyproject.toml) # kubernetes # requests cffi==1.16.0 @@ -46,7 +37,7 @@ coverage[toml]==7.3.3 # via # coverage # pytest-cov -cryptography==42.0.5 +cryptography==43.0.1 # via # acto (pyproject.toml) # ansible-core @@ -58,31 +49,27 @@ distlib==0.3.8 # via virtualenv docker==6.1.3 # via acto (pyproject.toml) -exceptiongroup==1.2.0 - # via pytest +durationpy==0.9 + # via kubernetes exrex==0.11.0 # via acto (pyproject.toml) filelock==3.13.1 # via virtualenv -frozenlist==1.4.1 - # via - # aiohttp - # aiosignal google-auth==2.25.2 # via kubernetes identify==2.5.33 # via pre-commit -idna==3.6 +idna==3.10 # via + # acto (pyproject.toml) # requests - # yarl iniconfig==2.0.0 # via pytest isort==5.13.2 # via # acto (pyproject.toml) # pylint -jinja2==3.1.3 +jinja2==3.1.4 # via # acto (pyproject.toml) # ansible-core @@ -94,16 +81,12 @@ jsonref==1.1.0 # via acto (pyproject.toml) jsonschema==4.17.3 # via acto (pyproject.toml) -kubernetes==26.1.0 +kubernetes==31.0.0 # via acto (pyproject.toml) markupsafe==2.1.3 # via jinja2 mccabe==0.7.0 # via pylint -multidict==6.0.4 - # via - # aiohttp - # yarl mypy==1.7.1 # via acto (pyproject.toml) mypy-extensions==1.0.0 @@ -115,7 +98,9 @@ nodeenv==1.8.0 numpy==1.26.2 # via pandas oauthlib==3.2.2 - # via requests-oauthlib + # via + # kubernetes + # requests-oauthlib ordered-set==4.1.0 # via deepdiff packaging==23.2 @@ -178,7 +163,7 @@ pyyaml==6.0.1 # ansible-core # kubernetes # pre-commit -requests==2.31.0 +requests==2.32.3 # via # acto (pyproject.toml) # docker @@ -200,29 +185,18 @@ six==1.16.0 # python-dateutil tabulate==0.9.0 # via acto (pyproject.toml) -tomli==2.0.1 - # via - # black - # build - # coverage - # mypy - # pip-tools - # pylint - # pyproject-hooks - # pytest tomlkit==0.12.3 # via pylint typing-extensions==4.9.0 # via - # astroid - # black # mypy # pydantic # pydantic-core tzdata==2023.3 # via pandas -urllib3==2.1.0 +urllib3==2.2.3 # via + # acto (pyproject.toml) # docker # kubernetes # requests @@ -234,8 +208,6 @@ websocket-client==1.7.0 # kubernetes wheel==0.42.0 # via pip-tools -yarl==1.9.4 - # via aiohttp # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements.txt b/requirements.txt index 5591017de0..9ef188a2b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.10 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --output-file=requirements.txt @@ -10,22 +10,25 @@ attrs==23.1.0 # via jsonschema cachetools==5.3.2 # via google-auth -certifi==2023.11.17 +certifi==2024.8.30 # via + # acto (pyproject.toml) # kubernetes # requests charset-normalizer==3.3.2 # via requests deepdiff==6.3.1 # via acto (pyproject.toml) -exceptiongroup==1.2.0 - # via pytest +durationpy==0.9 + # via kubernetes exrex==0.11.0 # via acto (pyproject.toml) google-auth==2.25.2 # via kubernetes -idna==3.6 - # via requests +idna==3.10 + # via + # acto (pyproject.toml) + # requests iniconfig==2.0.0 # via pytest jsonpatch==1.33 @@ -34,12 +37,14 @@ jsonpointer==2.4 # via jsonpatch jsonschema==4.17.3 # via acto (pyproject.toml) -kubernetes==26.1.0 +kubernetes==31.0.0 # via acto (pyproject.toml) numpy==1.26.2 # via pandas oauthlib==3.2.2 - # via requests-oauthlib + # via + # kubernetes + # requests-oauthlib ordered-set==4.1.0 # via deepdiff packaging==23.2 @@ -72,7 +77,7 @@ pyyaml==6.0.1 # via # acto (pyproject.toml) # kubernetes -requests==2.31.0 +requests==2.32.3 # via # acto (pyproject.toml) # kubernetes @@ -89,20 +94,16 @@ six==1.16.0 # via # kubernetes # python-dateutil -tomli==2.0.1 - # via pytest typing-extensions==4.9.0 # via # pydantic # pydantic-core tzdata==2023.3 # via pandas -urllib3==2.1.0 +urllib3==2.2.3 # via + # acto (pyproject.toml) # kubernetes # requests websocket-client==1.7.0 # via kubernetes - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/test/integration_tests/test_semantic_tests.py b/test/integration_tests/test_semantic_tests.py index 46570f97ed..a23baa0b39 100644 --- a/test/integration_tests/test_semantic_tests.py +++ b/test/integration_tests/test_semantic_tests.py @@ -113,12 +113,14 @@ def test_rbop_tests(self): curr_input_with_schema, field_path, testcase, setup=True ) - if not testcase.test_precondition( - curr_input_with_schema.get_value_by_path(list(field_path)) - ): + field_curr_value = curr_input_with_schema.get_value_by_path( + list(field_path) + ) + if not testcase.test_precondition(field_curr_value): raise AssertionError( "Test precondition failed after applying the test case" f" {testcase} to the field {field_path_str}" + f" current value: {field_curr_value}" ) group.finish_testcase()