From bee27bb20efa2fdf32396fef50e8fc5957840c8b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 8 Jun 2024 09:51:22 +0200 Subject: [PATCH 1/8] chore(deps): lock file maintenance (#851) --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 8700bd528..3d019a55e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -35,13 +35,13 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p [[package]] name = "certifi" -version = "2024.2.2" +version = "2024.6.2" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, - {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, + {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, + {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, ] [[package]] From 3ee0404aa07cd56ee67063c4c86aaeaeb3dbb7be Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:30:32 +0200 Subject: [PATCH 2/8] chore(deps): update dependency urllib3 to v1.26.19 [security] (#852) --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3d019a55e..80a5f7bbb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -755,13 +755,13 @@ files = [ [[package]] name = "urllib3" -version = "1.26.18" +version = "1.26.19" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ - {file = "urllib3-1.26.18-py2.py3-none-any.whl", hash = "sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07"}, - {file = "urllib3-1.26.18.tar.gz", hash = "sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0"}, + {file = "urllib3-1.26.19-py2.py3-none-any.whl", hash = "sha256:37a0344459b199fce0e80b0d3569837ec6b6937435c5244e7fd73fa6006830f3"}, + {file = "urllib3-1.26.19.tar.gz", hash = "sha256:3e3d753a8618b86d7de333b4223005f68720bcd6a7d2bcb9fbd2229ec7c1e429"}, ] [package.extras] From a5236e55562df33eadac69679aa5765f29162e2d Mon Sep 17 00:00:00 2001 From: kkedziak Date: Wed, 26 Jun 2024 10:47:20 +0200 Subject: [PATCH 3/8] Schema changes for LR notes --- .../standard_lib/sample_generation/schema.xsd | 2 + .../test_data/xmls/lr_incorrect.xml | 44 +++++++++++++++++++ .../test_data/xmls/lr_notes.xml | 43 ++++++++++++++++++ .../test_data/xmls/lr_without_notes.xml | 43 ++++++++++++++++++ .../tests_sample_generation/test_schema.py | 29 ++++++++++++ 5 files changed, 161 insertions(+) create mode 100644 tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_incorrect.xml create mode 100644 tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_notes.xml create mode 100644 tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_without_notes.xml create mode 100644 tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py diff --git a/pytest_splunk_addon/standard_lib/sample_generation/schema.xsd b/pytest_splunk_addon/standard_lib/sample_generation/schema.xsd index 85da743aa..6f2e9bc1b 100644 --- a/pytest_splunk_addon/standard_lib/sample_generation/schema.xsd +++ b/pytest_splunk_addon/standard_lib/sample_generation/schema.xsd @@ -83,6 +83,7 @@ + @@ -103,6 +104,7 @@ + diff --git a/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_incorrect.xml b/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_incorrect.xml new file mode 100644 index 000000000..b6de81f00 --- /dev/null +++ b/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_incorrect.xml @@ -0,0 +1,44 @@ + + + Microsoft + Sysmon + + + + HELLO + + + lab, index = * EventCode=19 + + Some event level note!!! + 19341900x8000000000000000114712Microsoft-Windows-Sysmon/Operationalserver1-WmiFilterEvent2023-08-24 08:52:46.443CreatedSERVER1\Administrator "root\\cimv2" "ServiceFilter_creation_for_EventID19" "select Look_ME_UP_eventID19 from __instanceModificationEvent within 5 where targetInstance isa 'non_existent'"]]> + + + Change:Endpoint_Changes + + + + + + + + + + + + + + + + + + command + object + object_attrs + object_id + object_path + result_id + + + + diff --git a/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_notes.xml b/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_notes.xml new file mode 100644 index 000000000..70169e35b --- /dev/null +++ b/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_notes.xml @@ -0,0 +1,43 @@ + + + Microsoft + Sysmon + + + + + + lab, index = * EventCode=19 + + Some event level note!!! + 19341900x8000000000000000114712Microsoft-Windows-Sysmon/Operationalserver1-WmiFilterEvent2023-08-24 08:52:46.443CreatedSERVER1\Administrator "root\\cimv2" "ServiceFilter_creation_for_EventID19" "select Look_ME_UP_eventID19 from __instanceModificationEvent within 5 where targetInstance isa 'non_existent'"]]> + + + Change:Endpoint_Changes + + + + + + + + + + + + + + + + + + command + object + object_attrs + object_id + object_path + result_id + + + + diff --git a/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_without_notes.xml b/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_without_notes.xml new file mode 100644 index 000000000..70169e35b --- /dev/null +++ b/tests/unit/tests_standard_lib/tests_sample_generation/test_data/xmls/lr_without_notes.xml @@ -0,0 +1,43 @@ + + + Microsoft + Sysmon + + + + + + lab, index = * EventCode=19 + + Some event level note!!! + 19341900x8000000000000000114712Microsoft-Windows-Sysmon/Operationalserver1-WmiFilterEvent2023-08-24 08:52:46.443CreatedSERVER1\Administrator "root\\cimv2" "ServiceFilter_creation_for_EventID19" "select Look_ME_UP_eventID19 from __instanceModificationEvent within 5 where targetInstance isa 'non_existent'"]]> + + + Change:Endpoint_Changes + + + + + + + + + + + + + + + + + + command + object + object_attrs + object_id + object_path + result_id + + + + diff --git a/tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py b/tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py new file mode 100644 index 000000000..1f6748ddb --- /dev/null +++ b/tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py @@ -0,0 +1,29 @@ +import os.path + +import pytest +from xmlschema import XMLSchema, XMLSchemaChildrenValidationError + +from pytest_splunk_addon.standard_lib.sample_generation.pytest_splunk_addon_data_parser import SCHEMA_PATH + + +@pytest.fixture +def validator() -> XMLSchema: + return XMLSchema(SCHEMA_PATH) + + +def get_xml(name: str) -> str: + with open(os.path.join(os.path.dirname(__file__), "test_data", "xmls", name)) as fp: + return fp.read() + + +def test_validate_schema(validator): + validator.validate(get_xml("lr_without_notes.xml")) + + +def test_validate_schema_incorrect_event_element(validator): + with pytest.raises(XMLSchemaChildrenValidationError): + validator.validate(get_xml("lr_incorrect.xml")) + + +def test_validate_schema_notes(validator): + validator.validate(get_xml("lr_notes.xml")) From 30a0350b9d45b9e7bdb33f07f466fd62b8131649 Mon Sep 17 00:00:00 2001 From: kkedziak Date: Thu, 27 Jun 2024 11:06:26 +0200 Subject: [PATCH 4/8] Fix precommit issue --- .../tests_standard_lib/tests_sample_generation/test_schema.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py b/tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py index 1f6748ddb..8b6b8f615 100644 --- a/tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py +++ b/tests/unit/tests_standard_lib/tests_sample_generation/test_schema.py @@ -3,7 +3,9 @@ import pytest from xmlschema import XMLSchema, XMLSchemaChildrenValidationError -from pytest_splunk_addon.standard_lib.sample_generation.pytest_splunk_addon_data_parser import SCHEMA_PATH +from pytest_splunk_addon.standard_lib.sample_generation.pytest_splunk_addon_data_parser import ( + SCHEMA_PATH, +) @pytest.fixture From c09a4bfce46b1d7ad803c83843bab82e64021579 Mon Sep 17 00:00:00 2001 From: kkedziak Date: Fri, 28 Jun 2024 15:53:49 +0200 Subject: [PATCH 5/8] Revert "chore(deps): update dependency urllib3 to v1.26.19 [security] (#852)" This reverts commit 3ee0404aa07cd56ee67063c4c86aaeaeb3dbb7be. --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 80a5f7bbb..3d019a55e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -755,13 +755,13 @@ files = [ [[package]] name = "urllib3" -version = "1.26.19" +version = "1.26.18" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" files = [ - {file = "urllib3-1.26.19-py2.py3-none-any.whl", hash = "sha256:37a0344459b199fce0e80b0d3569837ec6b6937435c5244e7fd73fa6006830f3"}, - {file = "urllib3-1.26.19.tar.gz", hash = "sha256:3e3d753a8618b86d7de333b4223005f68720bcd6a7d2bcb9fbd2229ec7c1e429"}, + {file = "urllib3-1.26.18-py2.py3-none-any.whl", hash = "sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07"}, + {file = "urllib3-1.26.18.tar.gz", hash = "sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0"}, ] [package.extras] From 3ffc096803090c3367102101ef7105539c7392dd Mon Sep 17 00:00:00 2001 From: kkedziak Date: Fri, 28 Jun 2024 15:53:49 +0200 Subject: [PATCH 6/8] Revert "chore(deps): lock file maintenance (#851)" This reverts commit bee27bb20efa2fdf32396fef50e8fc5957840c8b. --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3d019a55e..8700bd528 100644 --- a/poetry.lock +++ b/poetry.lock @@ -35,13 +35,13 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p [[package]] name = "certifi" -version = "2024.6.2" +version = "2024.2.2" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, - {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, + {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, + {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, ] [[package]] From c4dc6089f3a709d7323c2f9cc3357d3468bcc973 Mon Sep 17 00:00:00 2001 From: kkedziak Date: Fri, 28 Jun 2024 15:56:05 +0200 Subject: [PATCH 7/8] Poetry revert --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 8700bd528..ff6649cbd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -35,13 +35,13 @@ tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "p [[package]] name = "certifi" -version = "2024.2.2" +version = "2024.6.2" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, - {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, + {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, + {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516 "}, ] [[package]] From 2878f9facc3f4439215764176c8501b34e70e6f9 Mon Sep 17 00:00:00 2001 From: kkedziak Date: Fri, 28 Jun 2024 15:56:32 +0200 Subject: [PATCH 8/8] Poetry fix --- poetry.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index ff6649cbd..3d019a55e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -41,7 +41,7 @@ optional = false python-versions = ">=3.6" files = [ {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, - {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516 "}, + {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, ] [[package]]