Class GrpcDerivedHeaders
x-grpc-* request headers MockServer derives itself from the gRPC
request (the :path and the decoded frame), as opposed to metadata the client sent.
Why this exists. HttpRequest.withHeader appends rather than
replaces, so a client that sends its own x-grpc-service: evil leaves the converted request
carrying both values — [evil, com.example.GreetingService]. Header matching is SUB_SET, so
an expectation qualified by the spoofed service name would then match a stream that belongs to a
different service. Routing itself is driven by the real :path, so the impact is on
matching integrity rather than dispatch, but these headers are documented as server-derived and
must actually be.
strip(HttpRequest) is therefore called immediately before the derived values are set, on
every transport — HTTP/1.1 and HTTP/2 (GrpcToHttpRequestHandler), HTTP/2 bidi
(GrpcBidiRouterHandler) and HTTP/3 (GrpcHttp3Adapter,
Http3MockServerHandler).
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpRequeststrip(HttpRequest request) Removes any client-supplied copy of the derived headers, so the value MockServer sets next is the only one on the request.
-
Field Details
-
SERVICE
- See Also:
-
METHOD
- See Also:
-
ORIGINAL_CONTENT_TYPE
- See Also:
-
CLIENT_STREAMING
- See Also:
-
-
Method Details
-
strip
Removes any client-supplied copy of the derived headers, so the value MockServer sets next is the only one on the request. Returns the same instance for chaining.
-