New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with encoding in mailer responder #416

Closed
nadouani opened this Issue Feb 5, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@nadouani
Copy link
Contributor

nadouani commented Feb 5, 2019

Request Type

Bug

Work Environment

Question Answer
Cortex version / git hash 2.1.2
Package Type Docker thehiveproject/thehive:latest

Problem Description

Steps to Reproduce

  1. Create case with russian letters in Title or description in TheHive
  2. launch Mailer Responder from case menu
  3. Cortex shows following error for mailer responder
Invalid output
Traceback (most recent call last):
  File "Mailer/mailer.py", line 59, in <module>
    Mailer().run()
  File "Mailer/mailer.py", line 47, in run
    msg.attach(MIMEText(description, 'plain'))
  File "/usr/lib/python2.7/email/mime/text.py", line 30, in __init__
    self.set_payload(_text, _charset)
  File "/usr/lib/python2.7/email/message.py", line 226, in set_payload
    self.set_charset(charset)
  File "/usr/lib/python2.7/email/message.py", line 262, in set_charset
    self._payload = self._payload.encode(charset.output_charset)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)

Possible Solutions

in mailer.py do encode('utf-8') of title and description

title = self.get_param('data.title', None, 'title is missing')
**title=title.encode('utf-8')**
description = self.get_param('data.description', None, 'description is missing')
**description=description.encode('utf-8')**

Thanks to @bsploit for the issue and solution

@nadouani nadouani added the bug label Feb 5, 2019

@nadouani nadouani added this to the 1.15.2 milestone Feb 6, 2019

nadouani added a commit that referenced this issue Feb 6, 2019

@nadouani nadouani closed this Feb 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment