diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-08-19 07:26:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 07:26:03 -0400 |
commit | eebf52be060876ff14bbcbbc86b64ff9965b3622 (patch) | |
tree | a5c2e61430ff05dbd04e954a234b697acd6b9698 /synapse/logging | |
parent | Convert runWithConnection to async. (#8121) (diff) | |
download | synapse-eebf52be060876ff14bbcbbc86b64ff9965b3622.tar.xz |
Be stricter about JSON that is accepted by Synapse (#8106)
Diffstat (limited to 'synapse/logging')
-rw-r--r-- | synapse/logging/opentracing.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py index 21dbd9f415..abe532d350 100644 --- a/synapse/logging/opentracing.py +++ b/synapse/logging/opentracing.py @@ -177,6 +177,7 @@ from canonicaljson import json from twisted.internet import defer from synapse.config import ConfigError +from synapse.util import json_decoder if TYPE_CHECKING: from synapse.http.site import SynapseRequest @@ -499,7 +500,9 @@ def start_active_span_from_edu( if opentracing is None: return _noop_context_manager() - carrier = json.loads(edu_content.get("context", "{}")).get("opentracing", {}) + carrier = json_decoder.decode(edu_content.get("context", "{}")).get( + "opentracing", {} + ) context = opentracing.tracer.extract(opentracing.Format.TEXT_MAP, carrier) _references = [ opentracing.child_of(span_context_from_string(x)) @@ -699,7 +702,7 @@ def span_context_from_string(carrier): Returns: The active span context decoded from a string. """ - carrier = json.loads(carrier) + carrier = json_decoder.decode(carrier) return opentracing.tracer.extract(opentracing.Format.TEXT_MAP, carrier) |