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

Ensure that bytes/str values are decoded to utf-8 #260

Merged
merged 7 commits into from
Aug 21, 2018

Conversation

kolanos
Copy link
Contributor

@kolanos kolanos commented Aug 15, 2018

Closes #259

@kolanos kolanos requested a review from pselle August 15, 2018 00:33


def ensure_utf8(v):
"""Ensures that a binary value is dedoced into utf-8"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decoded*

Copy link
Contributor

@pselle pselle left a 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
Copy link

codecov bot commented Aug 16, 2018

Codecov Report

Merging #260 into master will increase coverage by 0.25%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
iopipe/compat.py 100% <ø> (+30%) ⬆️
iopipe/contrib/trace/util.py 100% <100%> (ø) ⬆️
iopipe/contrib/trace/auto_http.py 81.08% <100%> (+0.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24d4f73...456367e. Read the comment docs.

Copy link

@XerTheSquirrel XerTheSquirrel left a 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?

@@ -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)}

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?

)

response_headers = []
if hasattr(http_response, "headers"):
response_headers = [
{"key": k, "string": v}
{"key": k, "string": ensure_utf8(v)}

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?

@kolanos kolanos merged commit ed9f793 into iopipe:master Aug 21, 2018
@kolanos kolanos deleted the issue/259 branch August 21, 2018 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants