Skip to content

accept colon and double quote in header values - #130

Merged
pawsten merged 1 commit into
dynatrace-oss:mainfrom
knQzx:fix/header-value-charset
Aug 20, 2026
Merged

pawsten merged 1 commit into
dynatrace-oss:mainfrom
knQzx:fix/header-value-charset

Conversation

@knQzx

@knQzx knQzx commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

VALID_HEADER_VALUE_SPECIAL_CHARS in libhttpparser/src/HttpRequestParser.cpp:33 lists the punctuation allowed in a header value, and it is missing : and ":

static constexpr std::string_view VALID_HEADER_VALUE_SPECIAL_CHARS{"`~!@#$%^&*()-_=+[]{}\\|;'<>,.?/ "};

both are ordinary field-content per RFC 7230, and the neighbouring sets in the same block allow the colon already (VALID_URL_SPECIAL_CHARS, VALID_HOST_HEADER_VALUE_SPECIAL_CHARS, VALID_CLIENT_IP_HEADER_VALUE_SPECIAL_CHARS). the two missing characters are the shifted forms of ; and ', which are both present, so this reads like a slip while typing the set

the effect is not limited to exotic requests. isValidHeaderValueChar returning false puts the parser in the invalid state and Discovery.cpp drops the whole session, so any request carrying one of these is lost:

  • Referer: https://example.com/ and Origin: https://example.com - rejected at the colon
  • Sec-CH-UA: "Chromium";v="124" - sent by Chrome and Edge on every request in a secure context
  • If-None-Match: "abc123" - quoted ETag

that is close to all browser traffic to a monitored service

changes

add : and " next to the characters they belong with, and add two cases to the valid-request suite covering a Referer and a Sec-CH-UA header

I built the test suite against the change: 33 tests pass, and against the previous parser exactly those two new cases fail while the other 31 still pass

Both are valid field-content per RFC 7230, and the neighbouring character sets
in the same block already allow the colon. Without them any request carrying a
Referer, Origin, Sec-CH-UA or quoted ETag header was treated as invalid and the
whole session was discarded.
@pawsten
pawsten self-requested a review August 10, 2026 12:53

@pawsten pawsten left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good

@pawsten
pawsten merged commit 5e78af0 into dynatrace-oss:main Aug 20, 2026
3 checks passed
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.

2 participants