Skip to content
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
Closed

Issue with encoding in mailer responder #416

nadouani opened this issue Feb 5, 2019 · 0 comments
Labels
category:bug Issue is related to a bug
Milestone

Comments

@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 category:bug Issue is related to a 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 as completed Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bug Issue is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant