Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into SOARHELP-2947
  • Loading branch information
ishans-crest committed Sep 11, 2024
2 parents 1c94200 + 11374b7 commit c61f44a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 33 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Some points to note: <ul> <li>Only files present in the <b>vault</b> can be atta
#### Action Parameters
PARAMETER | REQUIRED | DESCRIPTION | TYPE | CONTAINS
--------- | -------- | ----------- | ---- | --------
**from** | optional | Sender Address, domain can not include 'phantom', 'splunk', or 'cisco' | string | `email`
**from** | optional | Sender Address | string | `email`
**to** | required | List of recipients email addresses | string | `email`
**cc** | optional | List of recipients email addresses to include on cc line | string | `email`
**bcc** | optional | List of recipients email addresses to include on bcc line | string | `email`
Expand Down Expand Up @@ -367,7 +367,7 @@ If the <b>from</b> parameter is not provided, then the action will consider the
#### Action Parameters
PARAMETER | REQUIRED | DESCRIPTION | TYPE | CONTAINS
--------- | -------- | ----------- | ---- | --------
**from** | optional | Sender Address, domain can not include 'phantom', 'splunk', or 'cisco' | string | `email`
**from** | optional | Sender Address | string | `email`
**to** | required | List of recipients email addresses | string | `email`
**cc** | optional | List of recipients email addresses to include on cc line | string | `email`
**bcc** | optional | List of recipients email addresses to include on bcc line | string | `email`
Expand Down
1 change: 1 addition & 0 deletions release_notes/3.2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Removed doamin restrictions for 'from' field in **send email** and **send htmlemail** actions as they were too strict [PAPP-34625]
6 changes: 3 additions & 3 deletions smtp.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "email",
"main_module": "smtp_connector.py",
"app_version": "3.3.0",
"utctime_updated": "2023-01-23T18:26:04.000000Z",
"utctime_updated": "2024-03-06T13:04:08.000000Z",
"package_name": "phantom_smtp",
"product_vendor": "Generic",
"product_name": "SMTP",
Expand Down Expand Up @@ -135,7 +135,7 @@
"read_only": false,
"parameters": {
"from": {
"description": "Sender Address, domain can not include 'phantom', 'splunk', or 'cisco'",
"description": "Sender Address",
"data_type": "string",
"order": 0,
"contains": [
Expand Down Expand Up @@ -404,7 +404,7 @@
"read_only": false,
"parameters": {
"from": {
"description": "Sender Address, domain can not include 'phantom', 'splunk', or 'cisco'",
"description": "Sender Address",
"data_type": "string",
"order": 0,
"primary": true,
Expand Down
28 changes: 0 additions & 28 deletions smtp_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,6 @@ def _validate_integer(self, action_result, parameter, key, allow_zero=False):

return phantom.APP_SUCCESS, parameter

def _validate_sender_email(self, action_result, input_data):
# sender emails also have additional restriction
# to not include splunk related terms in the domain name
restricted_domains = ["splunk", "cisco", "phantom"]
domain = input_data.split("@")[-1].lower()

if any(restricted_domain in domain for restricted_domain in restricted_domains):
return action_result.set_status(
phantom.APP_ERROR,
"The domain provided in email is restricted (contains one of : splunk, cisco, phantom).\
Please use a different email in the 'from' field."
)

return action_result.set_status(phantom.APP_SUCCESS)

def make_rest_call(self, action_result, url, verify=False):

try:
Expand Down Expand Up @@ -812,7 +797,6 @@ def _is_html(self, body):
return False

def _send_email(self, param, action_result):
action_id = self.get_action_identifier()

# username = self.get_config()[phantom.APP_JSON_USERNAME]
config = self.get_config()
Expand All @@ -821,12 +805,6 @@ def _send_email(self, param, action_result):
sender_address = config.get('sender_address', config.get(phantom.APP_JSON_USERNAME))
email_from = param.get(SMTP_JSON_FROM, sender_address)

# validate sender email if inputted as a parameter
if action_id != "test_connectivity" and param.get(SMTP_JSON_FROM):
ret_val = self._validate_sender_email(action_result, email_from)
if phantom.is_fail(ret_val):
return action_result.get_status()

encoding = config.get(SMTP_ENCODING, False)
smtputf8 = config.get(SMTP_ALLOW_SMTPUTF8, False)
body = param[SMTP_JSON_BODY]
Expand Down Expand Up @@ -1048,12 +1026,6 @@ def _handle_send_htmlemail(self, param): # noqa: C901
sender_address = config.get('sender_address', config.get(phantom.APP_JSON_USERNAME))
email_from = param.get(SMTP_JSON_FROM, sender_address)

# validate sender email if inputted as a parameter
if param.get(SMTP_JSON_FROM):
ret_val = self._validate_sender_email(action_result, email_from)
if phantom.is_fail(ret_val):
return action_result.get_status()

email_to = param['to']
email_cc = param.get('cc')
email_bcc = param.get('bcc')
Expand Down

0 comments on commit c61f44a

Please sign in to comment.