Skip to content

Commit

Permalink
SMTP: Bug fix related to inline and encoded images [PAPP-30315, PAPP-…
Browse files Browse the repository at this point in the history
…31591] (#18)

* Bug fix related to inline attachment [PAPP-30315]

* Update README.md

* Updated app version and dependencies

* Update README.md

* Removed unused dependencies from json

* Updated min_phantom_version

* Update README.md

* Bug fix for base64 encoded images inside html

* updated min phantom version and latest tested version

* Update README.md

---------

Co-authored-by: splunk-soar-connectors-admin <admin@splunksoar>
  • Loading branch information
dhwanis-crest and splunk-soar-connectors-admin committed Sep 28, 2023
1 parent 2ce7e7e commit 444f793
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 47 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# SMTP

Publisher: Splunk
Connector Version: 3.0.0
Connector Version: 3.1.0
Product Vendor: Generic
Product Name: SMTP
Product Version Supported (regex): ".\*"
Minimum Product Version: 6.0.0
Minimum Product Version: 6.1.0

This app provides the ability to send email using SMTP

Expand Down
1 change: 1 addition & 0 deletions release_notes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**Unreleased**
* Bug fix related to inline and encoded images [PAPP-30315, PAPP-31591]
45 changes: 4 additions & 41 deletions smtp.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"publisher": "Splunk",
"type": "email",
"main_module": "smtp_connector.py",
"app_version": "3.0.0",
"app_version": "3.1.0",
"utctime_updated": "2023-01-23T18:26:04.000000Z",
"package_name": "phantom_smtp",
"product_vendor": "Generic",
"product_name": "SMTP",
"product_version_regex": ".*",
"min_phantom_version": "6.0.0",
"min_phantom_version": "6.1.0",
"rest_handler": "request_handler.handle_request",
"license": "Copyright (c) 2016-2023 Splunk Inc.",
"logo": "logo_splunk.svg",
"logo_dark": "logo_splunk_dark.svg",
"python_version": "3",
"fips_compliant": true,
"latest_tested_versions": [
"smtp.gmail.com, smtp.office365.com May 17, 2023"
"smtp.gmail.com, smtp.office365.com September 26, 2023"
],
"configuration": {
"server": {
Expand Down Expand Up @@ -700,44 +700,7 @@
}
],
"pip_dependencies": {
"wheel": [
{
"module": "beautifulsoup4",
"input_file": "wheels/py3/beautifulsoup4-4.9.1-py3-none-any.whl"
},
{
"module": "bleach",
"input_file": "wheels/shared/bleach-3.3.1-py2.py3-none-any.whl"
},
{
"module": "bleach_allowlist",
"input_file": "wheels/shared/bleach_allowlist-1.0.3-py2.py3-none-any.whl"
},
{
"module": "chardet",
"input_file": "wheels/shared/chardet-3.0.4-py2.py3-none-any.whl"
},
{
"module": "packaging",
"input_file": "wheels/py3/packaging-21.3-py3-none-any.whl"
},
{
"module": "pyparsing",
"input_file": "wheels/py3/pyparsing-3.0.9-py3-none-any.whl"
},
{
"module": "six",
"input_file": "wheels/shared/six-1.16.0-py2.py3-none-any.whl"
},
{
"module": "soupsieve",
"input_file": "wheels/py3/soupsieve-2.3.2.post1-py3-none-any.whl"
},
{
"module": "webencodings",
"input_file": "wheels/shared/webencodings-0.5.1-py2.py3-none-any.whl"
}
]
"wheel": []
},
"pip39_dependencies": {
"wheel": [
Expand Down
7 changes: 4 additions & 3 deletions smtp_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,8 @@ def _handle_send_htmlemail(self, param): # noqa: C901
text=email_html,
tags=self.SAFE_HTML_TAGS,
attributes=BLEACH_SAFE_HTML_ATTRIBUTES,
css_sanitizer=CSSSanitizer(allowed_css_properties=all_styles)
css_sanitizer=CSSSanitizer(allowed_css_properties=all_styles),
protocols=list(bleach.ALLOWED_PROTOCOLS) + SMTP_BLEACH_ALLOWED_PROTOCOLS
)
email_html = unescape(email_html)

Expand Down Expand Up @@ -1204,10 +1205,10 @@ def _handle_send_htmlemail(self, param): # noqa: C901
except Exception:
return action_result.set_status(phantom.APP_ERROR, "Error: failed to read the file for the vault ID: {}".format(vault_id))

attachment.add_header('Content-Disposition', 'attachment', filename=filename)
if content_id:
attachment.add_header('Content-ID', "<{}>".format(content_id.strip().lstrip('<').rstrip('>').strip()))

else:
attachment.add_header('Content-Disposition', 'attachment', filename=filename)
root.attach(attachment)

else:
Expand Down
1 change: 1 addition & 0 deletions smtp_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,4 @@
"type"
]
}
SMTP_BLEACH_ALLOWED_PROTOCOLS = ["cid", "data", "tel", "sms", "geo", "webcal", "callto"]
Binary file removed wheels/py3/certifi-2022.12.7-py3-none-any.whl
Binary file not shown.
Binary file removed wheels/py3/packaging-21.3-py3-none-any.whl
Binary file not shown.
Binary file removed wheels/py3/pyparsing-3.0.9-py3-none-any.whl
Binary file not shown.
Binary file removed wheels/py3/soupsieve-2.3.2.post1-py3-none-any.whl
Binary file not shown.
Binary file removed wheels/shared/bleach-3.3.1-py2.py3-none-any.whl
Binary file not shown.
Binary file removed wheels/shared/chardet-3.0.4-py2.py3-none-any.whl
Binary file not shown.

0 comments on commit 444f793

Please sign in to comment.