-
Notifications
You must be signed in to change notification settings - Fork 17
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
Ensure that bytes/str values are decoded to utf-8 #260
Conversation
iopipe/contrib/trace/util.py
Outdated
|
||
|
||
def ensure_utf8(v): | ||
"""Ensures that a binary value is dedoced into utf-8""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decoded*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM code-wise, there's a typo Corey already pointed out, and the build for py3 is failing
Codecov Report
@@ Coverage Diff @@
## master #260 +/- ##
==========================================
+ Coverage 83.37% 83.62% +0.25%
==========================================
Files 34 34
Lines 1125 1124 -1
==========================================
+ Hits 938 940 +2
+ Misses 187 184 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main question is: Do the HTTP header keys also need to be protected by ensuring they are UTF-8?
iopipe/contrib/trace/auto_http.py
Outdated
@@ -139,36 +140,36 @@ def collect_metrics_for_response(http_response, context, trace, http_filter): | |||
request_headers = [] | |||
if hasattr(http_response.request, "headers"): | |||
request_headers = [ | |||
{"key": k, "string": v} | |||
{"key": k, "string": ensure_utf8(v)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the key for the headers also have their UTF-8 ensured?
iopipe/contrib/trace/auto_http.py
Outdated
) | ||
|
||
response_headers = [] | ||
if hasattr(http_response, "headers"): | ||
response_headers = [ | ||
{"key": k, "string": v} | ||
{"key": k, "string": ensure_utf8(v)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the response header key also have UTF-8 ensured?
Closes #259