From 59a6b8352ecf4c6b4c2572f2b2a7e485871edff1 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Thu, 8 Sep 2022 02:34:47 -0400 Subject: [PATCH 1/8] Bump version -> 1.2.1 --- src/falconpy/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/falconpy/_version.py b/src/falconpy/_version.py index 54d9dea99..4b8fad8a3 100644 --- a/src/falconpy/_version.py +++ b/src/falconpy/_version.py @@ -35,7 +35,7 @@ For more information, please refer to """ -_VERSION = '1.2.0' +_VERSION = '1.2.1' _MAINTAINER = 'Joshua Hiller' _AUTHOR = 'CrowdStrike' _AUTHOR_EMAIL = 'falconpy@crowdstrike.com' From a0891c9b681e50ddc874326f08369aaa98957749 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Thu, 8 Sep 2022 02:37:34 -0400 Subject: [PATCH 2/8] Add post_device_details_v2 alias. Closes #773. --- src/falconpy/hosts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/falconpy/hosts.py b/src/falconpy/hosts.py index 5e1285e74..869d46c7f 100644 --- a/src/falconpy/hosts.py +++ b/src/falconpy/hosts.py @@ -554,6 +554,7 @@ def query_network_address_history(self: object, *args, body: dict = None, **kwar GetDeviceDetailsV1 = get_device_details_v1 GetDeviceDetailsV2 = get_device_details_v2 PostDeviceDetailsV2 = get_device_details + post_device_details_v2 = get_device_details QueryHiddenDevices = query_hidden_devices GetOnlineState_V1 = get_online_state get_online_state_v1 = get_online_state # Issue 739 Helper alias From 993d3c25d8a40dc663f8bf16da26c3777a68b8f6 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Thu, 8 Sep 2022 02:38:04 -0400 Subject: [PATCH 3/8] Add post_device_details_v2 alias to manual testing --- tests/manual/test_get_device_details.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/manual/test_get_device_details.py b/tests/manual/test_get_device_details.py index e1bdd7980..9d26116df 100644 --- a/tests/manual/test_get_device_details.py +++ b/tests/manual/test_get_device_details.py @@ -70,6 +70,14 @@ def new_pep_syntax(self): returned = True return returned + def alias_pep_syntax(self): + """Test the new PostDeviceDetailsV2 operation using PEP 8 syntax.""" + returned = False + if self.get_a_device_id(): + if self.valid_status_code(falcon.post_device_details_v2(ids=DEVICE_ID)): + returned = True + return returned + def redirected_pep_syntax(self): """Tests PEP 8 syntax variations using the newly redirected method.""" returned = self.get_a_device_id() @@ -141,6 +149,10 @@ def test_new_pep_syntax(self): """Pytest harness hook.""" assert self.new_pep_syntax() is True + def test_alias_pep_syntax(self): + """Pytest harness hook.""" + assert self.alias_pep_syntax() is True + def test_redirected_opid_syntax(self): """Pytest harness hook.""" assert self.redirected_opid_syntax() is True From b180d5893bad0f94681bc6eebbb414d49e508bbc Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Fri, 9 Sep 2022 16:50:31 -0400 Subject: [PATCH 4/8] Update docstring typo. Closes #776. --- src/falconpy/incidents.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/falconpy/incidents.py b/src/falconpy/incidents.py index 2a9fdcc07..7e34cc0ac 100644 --- a/src/falconpy/incidents.py +++ b/src/falconpy/incidents.py @@ -120,7 +120,9 @@ def get_behaviors(self: object, body: dict = None, **kwargs) -> dict: def perform_incident_action(self: object, body: dict = None, **kwargs) -> dict: """Perform a set of actions on one or more incidents. - Such as: adding tags or comments or updating the incident name or description. + Such as: adding tags or updating the incident name or description. + + A maximum of 5000 incidents may be updated per request. Keyword arguments: action_parameters -- Action specific parameters. List of dictionaries. From 48e8aa88218c2c43ea5317527d8ff6b3844f78b9 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Fri, 9 Sep 2022 17:09:25 -0400 Subject: [PATCH 5/8] Allow 502 on API return for valid failures. --- tests/test_falcon_container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_falcon_container.py b/tests/test_falcon_container.py index 82d26052f..c6e40a15e 100644 --- a/tests/test_falcon_container.py +++ b/tests/test_falcon_container.py @@ -18,7 +18,7 @@ client_secret=falcon.auth_object.creds["client_secret"], base_url=falcon.auth_object.base_url ) -AllowedResponses = [200, 201, 400, 403, 404, 429] # Allowing 400 for now +AllowedResponses = [200, 201, 400, 403, 404, 429, 502] # Allowing no content returned as code paths are confirmed class TestFalconContainer: From f436dcf19c46449b681fe300f79573ebfee03fb2 Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Fri, 9 Sep 2022 17:11:30 -0400 Subject: [PATCH 6/8] Allow 201 on successful return. --- tests/test_kubernetes_protection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_kubernetes_protection.py b/tests/test_kubernetes_protection.py index 9d21d7520..0df73215f 100644 --- a/tests/test_kubernetes_protection.py +++ b/tests/test_kubernetes_protection.py @@ -13,7 +13,7 @@ auth = Authorization.TestAuthorization() config = auth.getConfigObject() falcon = KubernetesProtection(auth_object=config) -AllowedResponses = [200, 207, 400, 404, 403, 429, 500] # Allowing 500 to reduce flakiness +AllowedResponses = [200, 201, 207, 400, 404, 403, 429, 500] # Allowing 500 to reduce flakiness class TestKubeProtect: From fade3a744e977ba5ae59767bca0629c16890bd7d Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Fri, 9 Sep 2022 17:30:27 -0400 Subject: [PATCH 7/8] Add host_timeout_duration docstrings. Closes #774. --- src/falconpy/real_time_response.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/falconpy/real_time_response.py b/src/falconpy/real_time_response.py index 3ff1815de..cf335782e 100644 --- a/src/falconpy/real_time_response.py +++ b/src/falconpy/real_time_response.py @@ -159,6 +159,10 @@ def batch_active_responder_command(self: object, Refer to the RTR documentation for the full list of commands. batch_id -- Batch ID to execute the command on. Received from batch_init_session. String. command_string -- Full command string for the command. For example `get some_file.txt`. + host_timeout_duration -- Timeout duration for how long a host has time to complete processing. + Default value is a bit less than the overall timeout value. + It cannot be greater than the overall request timeout. Maximum is < 10 minutes. + Example, `10s`. Valid units: `ns, us, ms, s, m, h`. optional_hosts -- List of a subset of hosts we want to run the command on. If this list is supplied, only these hosts will receive the command. parameters -- full parameters payload in JSON format. Not required if using other keywords. @@ -210,6 +214,10 @@ def batch_command(self: object, body: dict = None, parameters: dict = None, **kw Refer to the RTR documentation for the full list of commands. batch_id -- Batch ID to execute the command on. Received from batch_init_session. String. command_string -- Full command string for the command. For example `get some_file.txt`. + host_timeout_duration -- Timeout duration for how long a host has time to complete processing. + Default value is a bit less than the overall timeout value. + It cannot be greater than the overall request timeout. Maximum is < 10 minutes. + Example, `10s`. Valid units: `ns, us, ms, s, m, h`. optional_hosts -- List of a subset of hosts we want to run the command on. If this list is supplied, only these hosts will receive the command. parameters -- full parameters payload in JSON format. Not required if using other keywords. @@ -296,6 +304,10 @@ def batch_get_command(self: object, batch_id -- Batch ID to execute the command on. Received from batch_init_session. String. file_path -- Full path to the file that is to be retrieved from each host in the batch. + host_timeout_duration -- Timeout duration for how long a host has time to complete processing. + Default value is a bit less than the overall timeout value. + It cannot be greater than the overall request timeout. Maximum is < 10 minutes. + Example, `10s`. Valid units: `ns, us, ms, s, m, h`. optional_hosts -- List of a subset of hosts we want to run the command on. If this list is supplied, only these hosts will receive the command. parameters -- full parameters payload in JSON format. Not required if using other keywords. @@ -349,6 +361,10 @@ def batch_init_sessions(self: object, existing_batch_id -- Optional batch ID. Use an existing batch ID if you want to initialize new hosts and add them to the existing batch. String. host_ids -- List of host agent ID's to initialize a RTR session on. List of strings. + host_timeout_duration -- Timeout duration for how long a host has time to complete processing. + Default value is a bit less than the overall timeout value. + It cannot be greater than the overall request timeout. Maximum is < 10 minutes. + Example, `10s`. Valid units: `ns, us, ms, s, m, h`. queue_offline -- Boolean indicating if the command should be queued for execution when the host returns online. parameters -- full parameters payload in JSON format. Not required if using other keywords. From 54f3eb7078ee01cc0aeb70adff62f9c371be787b Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Fri, 9 Sep 2022 17:31:26 -0400 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1e35f0c3..a92b36a23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# Version 1.2.1 +## Added features and functionality ++ Added: Added alias for `post_device_details_v2` to Hosts Service Class. Closes #773. + - `hosts.py` + - `tests/manual/test_get_device_details.py` + +## Issues resolved ++ Fixed: Typo in docstring for `perform_incident_action` method. Closes #776. + - `incidents.py` ++ Fixed: Added `host_timeout_duration` documentation to docstrings within operations in the Real Time Response Service Class. + - `real_time_response.py` + +## Other ++ Updated: Adjusted unit testing to cover new API returns. + - `tests/falcon_container.py` + - `tests/kubernetes_protection.py` + # Version 1.2.0 ## Added features and functionality + Updated: Updated operation payload parameter datatype details.