Skip to content

Commit

Permalink
Merge branch 'next' into SOARHELP-2947
Browse files Browse the repository at this point in the history
  • Loading branch information
hardik-crest committed May 6, 2024
2 parents 314e6a7 + 4cca296 commit 6c06e41
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Connector Version: 3.2.0
Product Vendor: Generic
Product Name: SMTP
Product Version Supported (regex): ".\*"
Minimum Product Version: 6.1.0
Minimum Product Version: 6.1.1

This app provides the ability to send email using SMTP

Expand Down
1 change: 1 addition & 0 deletions release_notes/3.1.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Bug fix for accessing vault temp directory path [PAPP-32426]
9 changes: 3 additions & 6 deletions smtp.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"product_vendor": "Generic",
"product_name": "SMTP",
"product_version_regex": ".*",
"min_phantom_version": "6.1.0",
"min_phantom_version": "6.1.1",
"rest_handler": "request_handler.handle_request",
"license": "Copyright (c) 2016-2024 Splunk Inc.",
"logo": "logo_splunk.svg",
Expand Down Expand Up @@ -699,9 +699,6 @@
}
}
],
"pip_dependencies": {
"wheel": []
},
"pip39_dependencies": {
"wheel": [
{
Expand All @@ -722,7 +719,7 @@
},
{
"module": "soupsieve",
"input_file": "wheels/py3/soupsieve-2.4.1-py3-none-any.whl"
"input_file": "wheels/py3/soupsieve-2.5-py3-none-any.whl"
},
{
"module": "tinycss2",
Expand All @@ -734,4 +731,4 @@
}
]
}
}
}
21 changes: 6 additions & 15 deletions smtp_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from bs4 import BeautifulSoup
from phantom.action_result import ActionResult
from phantom.base_connector import BaseConnector
from phantom.vault import Vault

from request_handler import RequestStateHandler, _get_dir_name_from_app_name
from smtp_consts import *
Expand Down Expand Up @@ -707,23 +706,15 @@ def _add_attachments(self, outer, attachments, action_result, message_encoding):
if '.pdf' not in attachment_vault_id:
return action_result.set_status(phantom.APP_ERROR, SMTP_ERROR_SMTP_SEND_EMAIL)

if hasattr(Vault, "get_phantom_home"):
report_dir_pre_4_0 = '{0}/www/reports'.format(self.get_phantom_home())
report_dir_post_4_0 = '{0}/vault/reports'.format(self.get_phantom_home())
else:
report_dir_pre_4_0 = '/opt/phantom/www/reports'
report_dir_post_4_0 = '/opt/phantom/vault/reports'
phantom_home_path = self.get_phantom_home()
report_dir = os.path.join(phantom_home_path, "vault", "reports")

filename = ''
for report_dir in (report_dir_post_4_0, report_dir_pre_4_0):
test_filename = os.path.join(report_dir, attachment_vault_id)
test_filename = os.path.abspath(test_filename)
test_filename = os.path.join(report_dir, attachment_vault_id)
test_filename = os.path.abspath(test_filename)

if os.path.isfile(test_filename):
filename = test_filename
break
filename = test_filename if os.path.isfile(test_filename) else ""

is_valid_path = filename.startswith(report_dir_pre_4_0) or filename.startswith(report_dir_post_4_0)
is_valid_path = filename.startswith(report_dir)

if not filename or not is_valid_path:
return action_result.set_status(phantom.APP_ERROR, SMTP_ERROR_SMTP_SEND_EMAIL)
Expand Down
Binary file removed wheels/py3/soupsieve-2.4.1-py3-none-any.whl
Binary file not shown.
Binary file added wheels/py3/soupsieve-2.5-py3-none-any.whl
Binary file not shown.

0 comments on commit 6c06e41

Please sign in to comment.