Skip to content

Commit

Permalink
Fix checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Feb 16, 2021
1 parent de3f1e1 commit 028feb4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: 73601dfc0c8ab622fb8a2bfd4c0b1ea6c3f91fa3
CORE_REPO_SHA: d151f5689874ce78ddedc9aa6051be28078d7de8

jobs:
build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
OT_SAMPLED_HEADER = "ot-tracer-sampled"
OT_BAGGAGE_PREFIX = "ot-baggage-"

_valid_header_name = re_compile(r"^[\w_^`!#$%&'*+.|~]+$")
_valid_header_value = re_compile(r"^[\t\x20-\x7e\x80-\xff]+$")
_valid_header_name = re_compile(r"[\w_^`!#$%&'*+.|~]+")
_valid_header_value = re_compile(r"[\t\x20-\x7e\x80-\xff]+")
_valid_extract_traceid = re_compile(r"[0-9a-f]{1,32}")
_valid_extract_spanid = re_compile(r"[0-9a-f]{1,16}")

Expand Down Expand Up @@ -71,9 +71,9 @@ def extract(

if (
traceid != INVALID_TRACE_ID
and _valid_extract_traceid.match(traceid) is not None
and _valid_extract_traceid.fullmatch(traceid) is not None
and spanid != INVALID_SPAN_ID
and _valid_extract_spanid.match(spanid) is not None
and _valid_extract_spanid.fullmatch(spanid) is not None
):
context = set_span_in_context(
DefaultSpan(
Expand Down Expand Up @@ -137,8 +137,8 @@ def inject(
for header_name, header_value in baggage.items():

if (
_valid_header_name.match(header_name) is None
or _valid_header_value.match(header_value) is None
_valid_header_name.fullmatch(header_name) is None
or _valid_header_value.fullmatch(header_value) is None
):
continue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_extract_malformed_trace_id(self):
self.ot_trace_propagator.extract(
carrier_getter,
{
OT_TRACE_ID_HEADER: "abc123",
OT_TRACE_ID_HEADER: "abc123!",
OT_SPAN_ID_HEADER: "e457b5a2e4d86bd1",
OT_SAMPLED_HEADER: "false",
},
Expand All @@ -302,7 +302,7 @@ def test_extract_malformed_span_id(self):
carrier_getter,
{
OT_TRACE_ID_HEADER: "64fe8b2a57d3eff7",
OT_SPAN_ID_HEADER: "abc123",
OT_SPAN_ID_HEADER: "abc123!",
OT_SAMPLED_HEADER: "false",
},
)
Expand Down

0 comments on commit 028feb4

Please sign in to comment.