insightconnect-plugin-runtime 6.0.1__tar.gz → 6.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {insightconnect_plugin_runtime-6.0.1/insightconnect_plugin_runtime.egg-info → insightconnect_plugin_runtime-6.1.1}/PKG-INFO +4 -2
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/README.md +3 -1
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/api/endpoints.py +21 -15
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/clients/aws_client.py +40 -4
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/helper.py +11 -2
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1/insightconnect_plugin_runtime.egg-info}/PKG-INFO +4 -2
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/setup.py +1 -1
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_aws_action.py +1 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/MANIFEST.in +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect-plugin-swagger.json +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/action.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/api/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/api/schemas.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/cli.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/clients/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/clients/oauth.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/connection.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/data/input_message_schema.json +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/data/output_message_schema.json +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/dispatcher.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/exceptions.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/metrics.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/plugin.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/server.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/step.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/task.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/trigger.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/util.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime/variables.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime.egg-info/SOURCES.txt +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime.egg-info/dependency_links.txt +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime.egg-info/requires.txt +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/insightconnect_plugin_runtime.egg-info/top_level.txt +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/setup.cfg +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/action.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/action.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/action.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/connection.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/task.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/trigger.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/trigger.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/trigger.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/komand_hello_world/util/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/hello_world/setup.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/tests/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/tests/conftest.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/tests/test_cli.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/tests/test_hello_world.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/hello_world/tests/test_server.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/__init__.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_action.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_api.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_custom_encoder.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_endpoints.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_exceptions.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_helpers.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_metrics.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_oauth.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_plugin.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_schema.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_server_cloud_plugins.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_server_spec.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_trigger.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_variables.py +0 -0
- {insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: insightconnect-plugin-runtime
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.1.1
|
|
4
4
|
Summary: InsightConnect Plugin Runtime
|
|
5
5
|
Home-page: https://github.com/rapid7/komand-plugin-sdk-python
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -211,7 +211,9 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
211
211
|
after cloning this repository.
|
|
212
212
|
|
|
213
213
|
## Changelog
|
|
214
|
-
* 6.
|
|
214
|
+
* 6.1.1 - Addressed vulnerabilities within the slim and non-slim Python images (bumping packages).
|
|
215
|
+
* 6.1.0 - Update AWSAction tests to utilise AWS Client Error names for connection test | Update `request_error_handling` to include input for custom configuration
|
|
216
|
+
* 6.0.1 - Address vulnerabilities within the following python packages: `Jinja2`, `requests`, `urllib3`, `zipp` and `setuptools`.
|
|
215
217
|
* 6.0.0 - Address vulnerabilities within `certifi` python package | Bump the version of OpenSSL used | If running a task connection test, return a custom message from the task test and not the full log.
|
|
216
218
|
* 5.6.1 - Making sure all paths that can call the task connection test endpoints return a 400 error if the test fails
|
|
217
219
|
* 5.6.0 - Add APIException class for error handling | Fix error in response_handler where data of type Response was not correctly being returned
|
|
@@ -182,7 +182,9 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
182
182
|
after cloning this repository.
|
|
183
183
|
|
|
184
184
|
## Changelog
|
|
185
|
-
* 6.
|
|
185
|
+
* 6.1.1 - Addressed vulnerabilities within the slim and non-slim Python images (bumping packages).
|
|
186
|
+
* 6.1.0 - Update AWSAction tests to utilise AWS Client Error names for connection test | Update `request_error_handling` to include input for custom configuration
|
|
187
|
+
* 6.0.1 - Address vulnerabilities within the following python packages: `Jinja2`, `requests`, `urllib3`, `zipp` and `setuptools`.
|
|
186
188
|
* 6.0.0 - Address vulnerabilities within `certifi` python package | Bump the version of OpenSSL used | If running a task connection test, return a custom message from the task test and not the full log.
|
|
187
189
|
* 5.6.1 - Making sure all paths that can call the task connection test endpoints return a 400 error if the test fails
|
|
188
190
|
* 5.6.0 - Add APIException class for error handling | Fix error in response_handler where data of type Response was not correctly being returned
|
|
@@ -28,6 +28,9 @@ from insightconnect_plugin_runtime.util import OutputMasker
|
|
|
28
28
|
logger = structlog.get_logger("plugin")
|
|
29
29
|
ORG_ID = "X-IPIMS-ORGID"
|
|
30
30
|
|
|
31
|
+
PLUGIN_SPEC_DOCKERFILE = "/python/src/plugin.spec.yaml"
|
|
32
|
+
PLUGIN_SPEC_PACK = "/workspace/plugin.spec.yaml"
|
|
33
|
+
|
|
31
34
|
|
|
32
35
|
# Must be defined at application level in order to capture all 404's with blueprints,
|
|
33
36
|
# see https://flask.palletsprojects.com/en/2.3.x/errorhandling/#blueprint-error-handlers
|
|
@@ -329,9 +332,7 @@ class Endpoints:
|
|
|
329
332
|
description: InsightConnect Plugin Information to be returned
|
|
330
333
|
schema: PluginInfoSchema
|
|
331
334
|
"""
|
|
332
|
-
plugin_spec_json = Endpoints.
|
|
333
|
-
"/python/src/plugin.spec.yaml"
|
|
334
|
-
)
|
|
335
|
+
plugin_spec_json = Endpoints.load_plugin_spec_file()
|
|
335
336
|
plugin_info_fields = [
|
|
336
337
|
"name",
|
|
337
338
|
"description",
|
|
@@ -430,9 +431,7 @@ class Endpoints:
|
|
|
430
431
|
400:
|
|
431
432
|
description: Bad request
|
|
432
433
|
"""
|
|
433
|
-
plugin_spec_json = Endpoints.
|
|
434
|
-
"/python/src/plugin.spec.yaml"
|
|
435
|
-
)
|
|
434
|
+
plugin_spec_json = Endpoints.load_plugin_spec_file()
|
|
436
435
|
Endpoints.action_trigger_task_exists(plugin_spec_json, "actions", name)
|
|
437
436
|
return jsonify(
|
|
438
437
|
ActionTriggerDetailsSchema().dump(
|
|
@@ -459,9 +458,7 @@ class Endpoints:
|
|
|
459
458
|
400:
|
|
460
459
|
description: Bad request
|
|
461
460
|
"""
|
|
462
|
-
plugin_spec_json = Endpoints.
|
|
463
|
-
"/python/src/plugin.spec.yaml"
|
|
464
|
-
)
|
|
461
|
+
plugin_spec_json = Endpoints.load_plugin_spec_file()
|
|
465
462
|
Endpoints.action_trigger_task_exists(plugin_spec_json, "tasks", name)
|
|
466
463
|
return jsonify(
|
|
467
464
|
TaskDetailsSchema().dump(plugin_spec_json.get("tasks").get(name))
|
|
@@ -486,9 +483,7 @@ class Endpoints:
|
|
|
486
483
|
400:
|
|
487
484
|
description: Bad request
|
|
488
485
|
"""
|
|
489
|
-
plugin_spec_json = Endpoints.
|
|
490
|
-
"/python/src/plugin.spec.yaml"
|
|
491
|
-
)
|
|
486
|
+
plugin_spec_json = Endpoints.load_plugin_spec_file()
|
|
492
487
|
Endpoints.action_trigger_task_exists(plugin_spec_json, "triggers", name)
|
|
493
488
|
return jsonify(
|
|
494
489
|
ActionTriggerDetailsSchema().dump(
|
|
@@ -559,8 +554,12 @@ class Endpoints:
|
|
|
559
554
|
jsonify({"error": "The specified format is not supported"}), 422
|
|
560
555
|
)
|
|
561
556
|
|
|
562
|
-
|
|
563
|
-
|
|
557
|
+
try:
|
|
558
|
+
with open(PLUGIN_SPEC_DOCKERFILE, "r") as p_spec:
|
|
559
|
+
plugin_spec = p_spec.read()
|
|
560
|
+
except FileNotFoundError:
|
|
561
|
+
with open(PLUGIN_SPEC_PACK, "r") as p_spec:
|
|
562
|
+
plugin_spec = p_spec.read()
|
|
564
563
|
|
|
565
564
|
if format_ == "yaml":
|
|
566
565
|
return plugin_spec
|
|
@@ -744,7 +743,14 @@ class Endpoints:
|
|
|
744
743
|
return actions_triggers_tasks.get(p_name)
|
|
745
744
|
|
|
746
745
|
@staticmethod
|
|
747
|
-
def
|
|
746
|
+
def load_plugin_spec_file() -> Dict[str, Any]:
|
|
747
|
+
try:
|
|
748
|
+
return Endpoints.load_file_json_format(PLUGIN_SPEC_DOCKERFILE)
|
|
749
|
+
except FileNotFoundError:
|
|
750
|
+
return Endpoints.load_file_json_format(PLUGIN_SPEC_PACK)
|
|
751
|
+
|
|
752
|
+
@staticmethod
|
|
753
|
+
def load_file_json_format(filename: str) -> Dict[str, Any]:
|
|
748
754
|
with open(filename, "r") as plugin_spec:
|
|
749
755
|
return yaml.safe_load(plugin_spec.read())
|
|
750
756
|
|
|
@@ -14,13 +14,26 @@ from botocore.exceptions import ClientError
|
|
|
14
14
|
|
|
15
15
|
import insightconnect_plugin_runtime
|
|
16
16
|
from insightconnect_plugin_runtime.action import Action
|
|
17
|
-
from insightconnect_plugin_runtime.exceptions import
|
|
17
|
+
from insightconnect_plugin_runtime.exceptions import (
|
|
18
|
+
PluginException,
|
|
19
|
+
ConnectionTestException,
|
|
20
|
+
)
|
|
18
21
|
from insightconnect_plugin_runtime.helper import clean
|
|
19
22
|
|
|
20
23
|
REGION = "region"
|
|
21
24
|
EXTERNAL_ID = "external_id"
|
|
22
25
|
ROLE_ARN = "role_arn"
|
|
23
26
|
ASSUME_ROLE_PARAMETERS = "assume_role_params"
|
|
27
|
+
AWS_CLIENT_ERRORS = [
|
|
28
|
+
"AccessDeniedException",
|
|
29
|
+
"InternalServerException",
|
|
30
|
+
"ResourceNotFoundException",
|
|
31
|
+
"InternalFailure",
|
|
32
|
+
"InvalidClientTokenId",
|
|
33
|
+
"NotAuthorized",
|
|
34
|
+
"ServiceUnavailable",
|
|
35
|
+
"OptInRequired",
|
|
36
|
+
]
|
|
24
37
|
|
|
25
38
|
|
|
26
39
|
class PaginationHelper:
|
|
@@ -36,7 +49,7 @@ class PaginationHelper:
|
|
|
36
49
|
limit_key: str = None,
|
|
37
50
|
more_results: str = None,
|
|
38
51
|
non_aggregate_keys: List[str] = None,
|
|
39
|
-
max_pages
|
|
52
|
+
max_pages: int = None, # if we want to limit how many pages of data we pull from AWS
|
|
40
53
|
):
|
|
41
54
|
self.input_token = input_token
|
|
42
55
|
self.output_token = output_token
|
|
@@ -512,7 +525,9 @@ class AWSAction(Action):
|
|
|
512
525
|
if self.pagination_helper:
|
|
513
526
|
while self.pagination_helper.check_pagination(params, response):
|
|
514
527
|
if self.pagination_helper.check_total_results(params, response):
|
|
515
|
-
self.logger.info(
|
|
528
|
+
self.logger.info(
|
|
529
|
+
"Reached max amount of pages per execution breaking..."
|
|
530
|
+
)
|
|
516
531
|
break
|
|
517
532
|
|
|
518
533
|
self.logger.info("Response was paginated. Performing another call.")
|
|
@@ -547,7 +562,28 @@ class AWSAction(Action):
|
|
|
547
562
|
endpoint = client._endpoint.host # pylint:disable=protected-access
|
|
548
563
|
response = requests.get(endpoint)
|
|
549
564
|
|
|
550
|
-
|
|
565
|
+
response_text = response.text
|
|
566
|
+
status_code = response.status_code
|
|
567
|
+
|
|
568
|
+
# AWS client errors are not always mapped predictably, and some service endpoints will return an unexpected
|
|
569
|
+
# result
|
|
570
|
+
if not (200 <= status_code <= 299):
|
|
571
|
+
if (
|
|
572
|
+
status_code in [401, 403, 404, 500, 503]
|
|
573
|
+
and "UnknownOperationException" not in response_text
|
|
574
|
+
):
|
|
575
|
+
raise ConnectionTestException(
|
|
576
|
+
cause=f"Error code {status_code} returned from AWS service",
|
|
577
|
+
assistance="Please check the response for more information",
|
|
578
|
+
data=response_text,
|
|
579
|
+
)
|
|
580
|
+
for error in AWS_CLIENT_ERRORS:
|
|
581
|
+
if error in response_text:
|
|
582
|
+
raise ConnectionTestException(
|
|
583
|
+
cause=f"Error code {status_code} returned from AWS service with {error} exception",
|
|
584
|
+
assistance="Please check the response for more information",
|
|
585
|
+
data=response_text,
|
|
586
|
+
)
|
|
551
587
|
|
|
552
588
|
if "properties" in self.output.schema:
|
|
553
589
|
response = helper.format_output(self.output.schema, {})
|
|
@@ -155,7 +155,11 @@ def extract_json(response: requests.Response) -> Dict:
|
|
|
155
155
|
)
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
def request_error_handling(
|
|
158
|
+
def request_error_handling(
|
|
159
|
+
custom_configs: Dict[int, Exception]={},
|
|
160
|
+
exception_data_location: str = None,
|
|
161
|
+
allowed_status_codes: List[str] = [],
|
|
162
|
+
) -> Union[Any, None]:
|
|
159
163
|
"""request_error_handling. This decorator allows a method that makes a request to complete with error handling.
|
|
160
164
|
A plugin exception will be raised whenever an error is caught. Response.raise_for_status() must be called in the
|
|
161
165
|
wrapped method to handle HTTPErrors.
|
|
@@ -182,7 +186,12 @@ def request_error_handling() -> Union[Any, None]:
|
|
|
182
186
|
)
|
|
183
187
|
except requests.exceptions.RequestException as exception:
|
|
184
188
|
if isinstance(exception, requests.exceptions.HTTPError):
|
|
185
|
-
response_handler(
|
|
189
|
+
response_handler(
|
|
190
|
+
exception.response,
|
|
191
|
+
data_location=exception_data_location,
|
|
192
|
+
custom_configs=custom_configs,
|
|
193
|
+
allowed_status_codes=allowed_status_codes
|
|
194
|
+
)
|
|
186
195
|
else:
|
|
187
196
|
raise PluginException(
|
|
188
197
|
preset=PluginException.Preset.UNKNOWN, data=str(exception)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: insightconnect-plugin-runtime
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.1.1
|
|
4
4
|
Summary: InsightConnect Plugin Runtime
|
|
5
5
|
Home-page: https://github.com/rapid7/komand-plugin-sdk-python
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -211,7 +211,9 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
211
211
|
after cloning this repository.
|
|
212
212
|
|
|
213
213
|
## Changelog
|
|
214
|
-
* 6.
|
|
214
|
+
* 6.1.1 - Addressed vulnerabilities within the slim and non-slim Python images (bumping packages).
|
|
215
|
+
* 6.1.0 - Update AWSAction tests to utilise AWS Client Error names for connection test | Update `request_error_handling` to include input for custom configuration
|
|
216
|
+
* 6.0.1 - Address vulnerabilities within the following python packages: `Jinja2`, `requests`, `urllib3`, `zipp` and `setuptools`.
|
|
215
217
|
* 6.0.0 - Address vulnerabilities within `certifi` python package | Bump the version of OpenSSL used | If running a task connection test, return a custom message from the task test and not the full log.
|
|
216
218
|
* 5.6.1 - Making sure all paths that can call the task connection test endpoints return a 400 error if the test fails
|
|
217
219
|
* 5.6.0 - Add APIException class for error handling | Fix error in response_handler where data of type Response was not correctly being returned
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/__init__.py
RENAMED
|
File without changes
|
{insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/plugin/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/test_oauth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{insightconnect_plugin_runtime-6.0.1 → insightconnect_plugin_runtime-6.1.1}/tests/unit/utils.py
RENAMED
|
File without changes
|