Skip to content

Commit d7d64e4

Browse files
authored
Merge pull request #31 from instana/validate-type-pre-json
Fix: Protect against byte based json
2 parents fd14b83 + 25fbc1a commit d7d64e4

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
language: python
22
python:
33
- "2.7"
4+
- "3.3"
5+
- "3.4"
6+
- "3.5"
47
- "3.6"
58
install: "pip install -r requirements.txt"
69
script: nosetests -v

instana/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"""
77

88
__author__ = 'Instana Inc.'
9-
__copyright__ = 'Copyright 2016 Instana Inc.'
10-
__credits__ = ['Pavlo Baron']
9+
__copyright__ = 'Copyright 2017 Instana Inc.'
10+
__credits__ = ['Pavlo Baron', 'Peter Giacomo Lombardo']
1111
__license__ = 'MIT'
12-
__version__ = '0.0.1'
13-
__maintainer__ = 'Pavlo Baron'
14-
__email__ = 'pavlo.baron@instana.com'
12+
__version__ = '0.6.6'
13+
__maintainer__ = 'Peter Giacomo Lombardo'
14+
__email__ = 'peter.lombardo@instana.com'
1515

1616
__all__ = ['sensor', 'tracer']

instana/agent.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,10 @@ def set_host(self, host):
135135
def set_port(self, port):
136136
self.port = port
137137

138-
def set_from(self, from_):
139-
self.from_ = From(**json.loads(from_))
138+
def set_from(self, json_string):
139+
if type(json_string) is bytes:
140+
raw_json = json_string.decode("UTF-8")
141+
else:
142+
raw_json = json_string
143+
144+
self.from_ = From(**json.loads(raw_json))

0 commit comments

Comments
 (0)