From a61b505ee356f40096d829db84b387d324a1956c Mon Sep 17 00:00:00 2001 From: Mai Morag <81917647+maimorag@users.noreply.github.com> Date: Wed, 31 May 2023 10:32:34 +0300 Subject: [PATCH] Align credentials stores- part 3 (#27023) * Google Key Management Service - moving to type 9 * update to type 9- BeyondTrust Password Safe * type 9 changes MailListener - POP3 * RL * undo changes * update to required: false * fix * trying fix * fix error * false * fix tests errors * cr * spacing --- Packs/BeyondTrust_Password_Safe/.pack-ignore | 2 +- .../BeyondTrust_Password_Safe.py | 4 +++- .../BeyondTrust_Password_Safe.yml | 10 ++++++++-- .../ReleaseNotes/1_1_1.md | 6 ++++++ .../BeyondTrust_Password_Safe/pack_metadata.json | 2 +- Packs/GoogleKeyManagementService/.pack-ignore | 2 -- .../GoogleKeyManagementService.py | 5 +++-- .../GoogleKeyManagementService.yml | 10 ++++++++-- .../ReleaseNotes/1_0_18.md | 6 ++++++ .../GoogleKeyManagementService/pack_metadata.json | 2 +- Packs/MailListener_-_POP3/.pack-ignore | 2 +- .../MailListener_POP3/MailListener_POP3.py | 7 +++++-- .../MailListener_POP3/MailListener_POP3.yml | 10 ++++++++-- .../MailListener_POP3/MailListener_POP3_test.py | 15 ++++++++++----- Packs/MailListener_-_POP3/ReleaseNotes/2_0_3.md | 6 ++++++ Packs/MailListener_-_POP3/pack_metadata.json | 2 +- 16 files changed, 68 insertions(+), 23 deletions(-) create mode 100644 Packs/BeyondTrust_Password_Safe/ReleaseNotes/1_1_1.md create mode 100644 Packs/GoogleKeyManagementService/ReleaseNotes/1_0_18.md create mode 100644 Packs/MailListener_-_POP3/ReleaseNotes/2_0_3.md diff --git a/Packs/BeyondTrust_Password_Safe/.pack-ignore b/Packs/BeyondTrust_Password_Safe/.pack-ignore index 050c894563b8..80f340b25460 100644 --- a/Packs/BeyondTrust_Password_Safe/.pack-ignore +++ b/Packs/BeyondTrust_Password_Safe/.pack-ignore @@ -1,5 +1,5 @@ [file:BeyondTrust_Password_Safe.yml] -ignore=BA108,BA109,IN145,BA124,BA109,IN145,BA124 +ignore=BA108,BA109,BA124,BA109,BA124 [known_words] beyondtrust diff --git a/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.py b/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.py index 94b1a46ad550..db29ae8d19e4 100644 --- a/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.py +++ b/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.py @@ -16,7 +16,9 @@ USERNAME = demisto.params().get('credentials', {}).get('identifier') PASSWORD = demisto.params().get('credentials', {}).get('password') -API_KEY = demisto.params().get('key') +API_KEY = demisto.params().get('credentials_key', {}).get('password') or demisto.params().get('key') +if not API_KEY or not(USERNAME and PASSWORD): + raise DemistoException('The API Key or username and password must be provided') SYSTEM_NAME = demisto.params().get('system_name') # Remove trailing slash to prevent wrong URL path to service SERVER = demisto.params()['url'][:-1] \ diff --git a/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.yml b/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.yml index c92f57a44412..f9a386749803 100644 --- a/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.yml +++ b/Packs/BeyondTrust_Password_Safe/Integrations/BeyondTrust_Password_Safe/BeyondTrust_Password_Safe.yml @@ -13,8 +13,14 @@ configuration: type: 9 - display: API Key name: key - required: true + required: false type: 4 + hidden: true +- name: credentials_key + required: false + type: 9 + displaypassword: API Key + hiddenusername: true - display: Trust any certificate (not secure) name: insecure required: false @@ -281,7 +287,7 @@ script: - 'false' description: Updates the credentials for a Managed Account, optionally applying the change to the Managed System. name: beyondtrust-change-credentials - dockerimage: demisto/python3:3.10.11.58677 + dockerimage: demisto/python3:3.10.11.61265 isfetch: false runonce: false script: '' diff --git a/Packs/BeyondTrust_Password_Safe/ReleaseNotes/1_1_1.md b/Packs/BeyondTrust_Password_Safe/ReleaseNotes/1_1_1.md new file mode 100644 index 000000000000..4e7d0eb53c04 --- /dev/null +++ b/Packs/BeyondTrust_Password_Safe/ReleaseNotes/1_1_1.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### BeyondTrust Password Safe +- Added the *API Key* integration parameters to support credentials fetching object. +- Updated the Docker image to: *demisto/python3:3.10.11.61265*. diff --git a/Packs/BeyondTrust_Password_Safe/pack_metadata.json b/Packs/BeyondTrust_Password_Safe/pack_metadata.json index 754959c97780..638cb3c95934 100644 --- a/Packs/BeyondTrust_Password_Safe/pack_metadata.json +++ b/Packs/BeyondTrust_Password_Safe/pack_metadata.json @@ -2,7 +2,7 @@ "name": "BeyondTrust Password Safe", "description": "Unified password and session management for seamless accountability and control over privileged accounts.", "support": "xsoar", - "currentVersion": "1.1.0", + "currentVersion": "1.1.1", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/GoogleKeyManagementService/.pack-ignore b/Packs/GoogleKeyManagementService/.pack-ignore index 5b311041acb4..e69de29bb2d1 100644 --- a/Packs/GoogleKeyManagementService/.pack-ignore +++ b/Packs/GoogleKeyManagementService/.pack-ignore @@ -1,2 +0,0 @@ -[file:GoogleKeyManagementService.yml] -ignore=IN145 \ No newline at end of file diff --git a/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.py b/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.py index fb90000cf73e..7cd98ee78130 100644 --- a/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.py +++ b/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.py @@ -37,8 +37,9 @@ def __init__(self, params: Dict[str, Any]): self.project = params.get('project') self.location = params.get('location') self.key_ring = params.get('key_ring') - self.service_account = params.get('service_account') - + self.service_account = params.get('credentials_service_account', {}).get('password') or params.get('service_account') + if not self.service_account: + raise DemistoException("User's Service Account JSON must be provided.") handle_proxy() # Creates an API client for the KMS API. try: diff --git a/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.yml b/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.yml index 43aa0f1452ef..d585da23ecb6 100644 --- a/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.yml +++ b/Packs/GoogleKeyManagementService/Integrations/GoogleKeyManagementService/GoogleKeyManagementService.yml @@ -5,8 +5,14 @@ commonfields: configuration: - display: User's Service Account JSON name: service_account - required: true + required: false type: 4 + hidden: true +- displaypassword: User's Service Account JSON + name: credentials_service_account + required: false + hiddenusername: true + type: 9 - display: Project in Google Cloud KMS name: project required: true @@ -1537,7 +1543,7 @@ script: - contextPath: GoogleKMS.PublicKey.Algorithm description: The algorithm used in the CryptoKey type: String - dockerimage: demisto/google-kms:1.0.0.42736 + dockerimage: demisto/google-kms:1.0.0.62005 isfetch: false longRunning: false longRunningPort: false diff --git a/Packs/GoogleKeyManagementService/ReleaseNotes/1_0_18.md b/Packs/GoogleKeyManagementService/ReleaseNotes/1_0_18.md new file mode 100644 index 000000000000..1d37ad41f6af --- /dev/null +++ b/Packs/GoogleKeyManagementService/ReleaseNotes/1_0_18.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### Google Key Management Service +- Added the *User's Service Account JSON* integration parameters to support credentials fetching object. +- Updated the Docker image to: *demisto/google-kms:1.0.0.62005*. diff --git a/Packs/GoogleKeyManagementService/pack_metadata.json b/Packs/GoogleKeyManagementService/pack_metadata.json index 213291752d96..566b77ec0ba1 100644 --- a/Packs/GoogleKeyManagementService/pack_metadata.json +++ b/Packs/GoogleKeyManagementService/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Google Key Management Service", "description": "Use the Google Key Management Service API for CryptoKey management and encrypt/decrypt functionality.", "support": "xsoar", - "currentVersion": "1.0.17", + "currentVersion": "1.0.18", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/MailListener_-_POP3/.pack-ignore b/Packs/MailListener_-_POP3/.pack-ignore index 2286029984f6..378ef575d27a 100644 --- a/Packs/MailListener_-_POP3/.pack-ignore +++ b/Packs/MailListener_-_POP3/.pack-ignore @@ -1,5 +1,5 @@ [file:MailListener_POP3.yml] -ignore=IN110,IN109,BA108,BA109,IN126,IN145 +ignore=IN110,IN109,BA108,BA109,IN126 [known_words] MailListener diff --git a/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.py b/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.py index 87eaaa8a054d..d83b9ba26405 100644 --- a/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.py +++ b/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.py @@ -13,7 +13,7 @@ ''' GLOBALS/PARAMS ''' SERVER = demisto.params().get('server', '') EMAIL = demisto.params().get('email', '') -PASSWORD = demisto.params().get('password', '') + PORT = int(demisto.params().get('port', '995')) SSL = demisto.params().get('ssl') FETCH_TIME = demisto.params().get('fetch_time', '7 days') @@ -33,10 +33,13 @@ def connect_pop3_server(): pop3_server_conn = poplib.POP3_SSL(SERVER, PORT) # type: ignore else: pop3_server_conn = poplib.POP3(SERVER, PORT) # type: ignore + password = demisto.params().get('credentials_password', {}).get('password') or demisto.params().get('password') + if not password: + raise DemistoException('Password must be provided') pop3_server_conn.getwelcome() # type: ignore pop3_server_conn.user(EMAIL) # type: ignore - pop3_server_conn.pass_(PASSWORD) # type: ignore + pop3_server_conn.pass_(password) # type: ignore def close_pop3_server_connection(): diff --git a/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.yml b/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.yml index 8a3730769409..9ac10646b3c6 100644 --- a/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.yml +++ b/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3.yml @@ -18,8 +18,14 @@ configuration: type: 0 - display: Password name: password - required: true + required: false type: 4 + hidden: true +- displaypassword: Password + name: credentials_password + required: false + hiddenusername: true + type: 9 - defaultvalue: 'true' display: Use SSL connection name: ssl @@ -47,7 +53,7 @@ script: script: '-' type: python subtype: python3 - dockerimage: demisto/python3:3.10.10.48392 + dockerimage: demisto/python3:3.10.11.61265 beta: false tests: - MailListener-POP3 - Test diff --git a/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3_test.py b/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3_test.py index a5f08a743a13..25095c28ae43 100644 --- a/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3_test.py +++ b/Packs/MailListener_-_POP3/Integrations/MailListener_POP3/MailListener_POP3_test.py @@ -1,10 +1,9 @@ -# -*- coding: iso-8859-1 -*- import base64 - -from MailListener_POP3 import parse_mail_parts +# -*- coding: iso-8859-1 -*- +import demistomock as demisto -def test_parse_mail_parts(): +def test_parse_mail_parts(mocker): """ Given - Email data @@ -15,6 +14,9 @@ def test_parse_mail_parts(): - Validate The result body. """ + from MailListener_POP3 import parse_mail_parts + mocker.patch.object(demisto, 'params', return_value={'credentials_password': {'password': 'password'}}) + class MockEmailPart: pass @@ -27,7 +29,7 @@ class MockEmailPart: assert body.encode('utf-8') == b'el Ni\xc3\xb1o' -def test_base64_mail_decode(): +def test_base64_mail_decode(mocker): """ Given - base64 email data which could not be decoded into utf-8 @@ -38,6 +40,9 @@ def test_base64_mail_decode(): - Validate that no exception is thrown - Validate The result body """ + from MailListener_POP3 import parse_mail_parts + mocker.patch.object(demisto, 'params', return_value={'credentials_password': {'password': 'password'}}) + class MockEmailPart: pass diff --git a/Packs/MailListener_-_POP3/ReleaseNotes/2_0_3.md b/Packs/MailListener_-_POP3/ReleaseNotes/2_0_3.md new file mode 100644 index 000000000000..4de24dcb1254 --- /dev/null +++ b/Packs/MailListener_-_POP3/ReleaseNotes/2_0_3.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### MailListener - POP3 +- Added the *Password* integration parameters to support credentials fetching object. +- Updated the Docker image to: *demisto/python3:3.10.11.61265*. diff --git a/Packs/MailListener_-_POP3/pack_metadata.json b/Packs/MailListener_-_POP3/pack_metadata.json index b7ebf8082db1..3072e69b8def 100644 --- a/Packs/MailListener_-_POP3/pack_metadata.json +++ b/Packs/MailListener_-_POP3/pack_metadata.json @@ -2,7 +2,7 @@ "name": "MailListener - POP3", "description": "Listen to a mailbox, enable incident triggering via e-mail", "support": "xsoar", - "currentVersion": "2.0.2", + "currentVersion": "2.0.3", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",