Skip to content

Commit

Permalink
Align credentials stores- part 3 (demisto#27023)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
maimorag authored and DNRRomero committed Jun 5, 2023
1 parent 7bca4e5 commit a61b505
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Packs/BeyondTrust_Password_Safe/.pack-ignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: ''
Expand Down
6 changes: 6 additions & 0 deletions Packs/BeyondTrust_Password_Safe/ReleaseNotes/1_1_1.md
Original file line number Diff line number Diff line change
@@ -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*.
2 changes: 1 addition & 1 deletion Packs/BeyondTrust_Password_Safe/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
2 changes: 0 additions & 2 deletions Packs/GoogleKeyManagementService/.pack-ignore
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
[file:GoogleKeyManagementService.yml]
ignore=IN145
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions Packs/GoogleKeyManagementService/ReleaseNotes/1_0_18.md
Original file line number Diff line number Diff line change
@@ -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*.
2 changes: 1 addition & 1 deletion Packs/GoogleKeyManagementService/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
2 changes: 1 addition & 1 deletion Packs/MailListener_-_POP3/.pack-ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[file:MailListener_POP3.yml]
ignore=IN110,IN109,BA108,BA109,IN126,IN145
ignore=IN110,IN109,BA108,BA109,IN126

[known_words]
MailListener
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down
6 changes: 6 additions & 0 deletions Packs/MailListener_-_POP3/ReleaseNotes/2_0_3.md
Original file line number Diff line number Diff line change
@@ -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*.
2 changes: 1 addition & 1 deletion Packs/MailListener_-_POP3/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down

0 comments on commit a61b505

Please sign in to comment.