insightconnect-plugin-runtime 5.6.1__py3-none-any.whl → 6.0.1__py3-none-any.whl

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.
@@ -402,6 +402,9 @@ class Plugin(object):
402
402
  status_code = None
403
403
  error_object = None
404
404
 
405
+ # Properties specific to tasks tests
406
+ task_test_log = None
407
+
405
408
  try:
406
409
  # Attempt to grab message type first
407
410
  message_type = input_message.get("type")
@@ -444,7 +447,7 @@ class Plugin(object):
444
447
  out_type = "task_event"
445
448
  if is_test:
446
449
  # state will not be returned by task's test method
447
- output = self.start_step(
450
+ output, task_test_log = self.start_step(
448
451
  input_message["body"],
449
452
  "task",
450
453
  struct_logger,
@@ -471,7 +474,7 @@ class Plugin(object):
471
474
  )
472
475
  elif message_type == "connection_test":
473
476
  out_type = "connection_test"
474
- output = self.start_step(
477
+ output, task_test_log = self.start_step(
475
478
  input_message["body"],
476
479
  "connection_test",
477
480
  struct_logger,
@@ -481,15 +484,28 @@ class Plugin(object):
481
484
  is_connection_test=True,
482
485
  connection_test_type=connection_test_type
483
486
  )
484
- except (ClientException, ServerException, PluginException, Exception) as e:
487
+ except (
488
+ ClientException,
489
+ ServerException,
490
+ PluginException,
491
+ ConnectionTestException,
492
+ Exception,
493
+ ) as error_message:
485
494
  success = False
486
- caught_exception = e
487
- struct_logger.exception(e)
495
+ caught_exception = error_message
496
+ struct_logger.exception(error_message)
497
+
498
+ # now returning the value of data instead of the log buffer for connection task tests - SOAR-16566
499
+ if isinstance(error_message, ConnectionTestException) and connection_test_type == "test_task":
500
+ task_test_log = f"{error_message.data}" if error_message.data else "Connection test failed"
488
501
  finally:
502
+ # if we are running a task connection test we want to return the pre-defined message
503
+ # rather than a stack trace of logs - SOAR-16566
504
+ log_message = task_test_log if task_test_log else log_stream.getvalue()
489
505
  output = self.envelope(
490
506
  out_type,
491
507
  input_message,
492
- log_stream.getvalue(),
508
+ log_message,
493
509
  success,
494
510
  output,
495
511
  str(caught_exception),
@@ -541,18 +557,25 @@ class Plugin(object):
541
557
  plugin_version=connection.meta.version,
542
558
  )
543
559
  )
560
+
561
+ # As the message type for both api/v1/connection/test and api/v1/connection/test_task calls are
562
+ # message_type == "connection_test", this means that both the task and normal connection test code
563
+ # hits this path and needs to have the same return structure, as a result we return None when
564
+ # connection.test is called, as there is no message returned along side it,
565
+ # and the code above then sees this and reads the "message" from the io buffer as normal
544
566
  if hasattr(connection, "test_task") and connection_test_type == "test_task":
545
567
  func = connection.test_task
568
+ output, log = func()
569
+ return output, log
546
570
  elif hasattr(connection, "test"):
547
571
  func = connection.test
572
+ output = func()
573
+ return output, None
548
574
  else:
549
575
  raise NotImplementedError(
550
576
  "The server successfully processed the request and is not "
551
577
  "returning any content (no connection test function)"
552
578
  )
553
- output = func()
554
-
555
- return output
556
579
 
557
580
  else:
558
581
  action_name = message_body[step_key]
@@ -626,8 +649,10 @@ class Plugin(object):
626
649
  if is_test:
627
650
  # Check if connection test func available. If so - use it (preferred). Else fallback to action/trigger test
628
651
  if hasattr(step.connection, "test"):
629
- if hasattr(step.connection, "test") and connection_test_type == "test_task":
652
+ if hasattr(step.connection, "test_task") and connection_test_type == "test_task":
630
653
  func = step.connection.test_task
654
+ output, log = func()
655
+ return output, log
631
656
  else:
632
657
  func = step.connection.test
633
658
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: insightconnect-plugin-runtime
3
- Version: 5.6.1
3
+ Version: 6.0.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
@@ -12,10 +12,10 @@ Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Natural Language :: English
13
13
  Classifier: Topic :: Software Development :: Build Tools
14
14
  Description-Content-Type: text/markdown
15
- Requires-Dist: requests ==2.32.0
15
+ Requires-Dist: requests ==2.32.2
16
16
  Requires-Dist: python-jsonschema-objects ==0.5.2
17
17
  Requires-Dist: jsonschema ==4.21.1
18
- Requires-Dist: certifi ==2024.2.2
18
+ Requires-Dist: certifi ==2024.07.04
19
19
  Requires-Dist: Flask ==3.0.2
20
20
  Requires-Dist: gunicorn ==22.0.0
21
21
  Requires-Dist: greenlet ==3.0.3
@@ -211,6 +211,8 @@ 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.0.1 - Address vulnerabilities within the following python packages: `Jinja2`, `requests`, `urllib3`, `zipp` and `setuptools`.
215
+ * 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.
214
216
  * 5.6.1 - Making sure all paths that can call the task connection test endpoints return a 400 error if the test fails
215
217
  * 5.6.0 - Add APIException class for error handling | Fix error in response_handler where data of type Response was not correctly being returned
216
218
  * 5.5.5 - Address bug with typing for type `Dict` in Python 3.8
@@ -6,7 +6,7 @@ insightconnect_plugin_runtime/dispatcher.py,sha256=ru7njnyyWE1-oD-VbZJ-Z8tELwvDf
6
6
  insightconnect_plugin_runtime/exceptions.py,sha256=Pvcdkx81o6qC2qU661x-DzNjuIMP82x52nPMSEqEo4s,8491
7
7
  insightconnect_plugin_runtime/helper.py,sha256=kXUt_yq6-9_wMdCIkS1fC3dddE8uwH9tcRITXvrJHIM,31178
8
8
  insightconnect_plugin_runtime/metrics.py,sha256=hf_Aoufip_s4k4o8Gtzz90ymZthkaT2e5sXh5B4LcF0,3186
9
- insightconnect_plugin_runtime/plugin.py,sha256=l09-NxNPIfjSyklO4Jnbwf5yHQdobkcs29sjFV6N2ZE,24904
9
+ insightconnect_plugin_runtime/plugin.py,sha256=Yf4LNczykDVc31F9G8uuJ9gxEsgmxmAr0n4pcZzichM,26393
10
10
  insightconnect_plugin_runtime/schema.py,sha256=jTNc6KAMqFpaDVWrAYhkVC6e8I63P3X7uVlJkAr1hiY,583
11
11
  insightconnect_plugin_runtime/server.py,sha256=09fxsbKf2ZZvSqRP2Bv9e9-fspDyEFR8_YgIFeMnXqQ,12578
12
12
  insightconnect_plugin_runtime/step.py,sha256=KdERg-789-s99IEKN61DR08naz-YPxyinPT0C_T81C4,855
@@ -78,7 +78,7 @@ tests/unit/test_server_spec.py,sha256=je97BaktgK0Fiz3AwFPkcmHzYtOJJNqJV_Fw5hrvqX
78
78
  tests/unit/test_trigger.py,sha256=E53mAUoVyponWu_4IQZ0IC1gQ9lakBnTn_9vKN2IZfg,1692
79
79
  tests/unit/test_variables.py,sha256=OUEOqGYZA3Nd5oKk5GVY3hcrWKHpZpxysBJcO_v5gzs,291
80
80
  tests/unit/utils.py,sha256=VooVmfpIgxmglNdtmT32AkEDFxHxyRHLK8RsCWjjYRY,2153
81
- insightconnect_plugin_runtime-5.6.1.dist-info/METADATA,sha256=Ytd-U6ssnfYqZdQ-KKlMfTjDi6fPOFsPGGHcULACkLg,14106
82
- insightconnect_plugin_runtime-5.6.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
83
- insightconnect_plugin_runtime-5.6.1.dist-info/top_level.txt,sha256=AJtyJOpiFzHxsbHUICTcUKXyrGQ3tZxhrEHsPjJBvEA,36
84
- insightconnect_plugin_runtime-5.6.1.dist-info/RECORD,,
81
+ insightconnect_plugin_runtime-6.0.1.dist-info/METADATA,sha256=pPg9Ga7HGld_pcfbufClvZT33bDT_5SdlW79WvbVcnI,14443
82
+ insightconnect_plugin_runtime-6.0.1.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
83
+ insightconnect_plugin_runtime-6.0.1.dist-info/top_level.txt,sha256=AJtyJOpiFzHxsbHUICTcUKXyrGQ3tZxhrEHsPjJBvEA,36
84
+ insightconnect_plugin_runtime-6.0.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.2.0)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5