Open danielkwinsor opened 4 years ago
cc @objectiser
@danielkwinsor Agree, should be treated as if no trace context has been supplied, and start a new trace (with new sampling decision).
Would you be interested in contributing a PR?
Revisiting this topic in light of log4j2 exploit in the wild -- yes, true, envoy is not vuln to that, but envoy may propagate an invalid x-b3-traceid header that could later be logged by a system that is vuln.
Description:
Send non hex characters as request header x-b3-traceid or x-b3-spanid, or send headers that are not of 64/128bit hex length. The tracer operates correctly and securely in the sense that it was not a sampled trace and was not submitted to zipkin collector.
However, this unverified data can then be sent to upstream, to access logs, added in headers_to_add, etc, with a small possible risk of introducing malicious input handled somewhere that was expecting a mandated format. Request to validate the traceid and span ids are of appropriate format, otherwise reject the supplied trace and start a new trace (just like what happens when trace is missing entirely) so that systems expect to always have valid headers with this config. An alternative is to strip all the headers. I believe that starting a new trace is the behavior of spring-cloud-sleuth.
Config:
Logs: There are no logs at debug level when this rejects the trace. Possibly could be logged or gauged.
Relevant: The below curl output demonstrates echoing back the input – notice it is not sampled with x-b3-sampled: 1