Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Commit

Permalink
metrics: properly escape commas in exception text
Browse files Browse the repository at this point in the history
The most secure way is using json.dumps
  • Loading branch information
vrutkovs committed Oct 25, 2016
1 parent b7a1608 commit 24af9a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ def get_stats(self):
errors = plugins_metadata['errors']
first_failed = sorted(errors.keys())[0]
plugins['failed_plugin'] = first_failed
plugins['exception'] = errors[first_failed].split("(")[0].replace(',', ' ')
exception_text = errors[first_failed].split("(")[0]
# Make sure quotes and commas are escaped
plugins['exception'] = json.dumps(exception_text)
except (KeyError, IndexError):
pass

Expand Down

0 comments on commit 24af9a6

Please sign in to comment.