-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider allowing a user to disable Host header validation #18522
Comments
A UDS with a path is the recommended value in these docs
https://github.com/kubernetes-csi/node-driver-registrar#required-arguments |
We should switch to path style validation, rather than disable altogether. |
nginx makes the same host validation of the :authority pseudo header I read now the RFC https://tools.ietf.org/html/rfc3986#section-3.2.2 twice The bottom line is that it is a "reg-name" and it is a UTF8 free-text
The reg-name syntax allows percent-encoded octets ... UTF8 like @blowdart wrote, |
Hi, i was doing something like: var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);
var endPoint = new UnixDomainSocketEndPoint("/../run/foo/bar.sock");
socket.Connect(endPoint);
Console.Writeline("It's working!");
var channel = GrpcChannel.ForAddress("/../run/foo/bar.sock"); The last part fails with the message "System.ArgumentException: Only 'http' and 'https' schemes are allowed" Some part of this makes sense? I'm trying to imitate golang things 😟 Thanks!!! |
GrpcChannel only supports TCP. Support for UDS and pipes is planned for 5.0 |
Do we know if the UDS client is URL-encoding the Perhaps this doesn't need special configuration and we just need to be validating pre decoding. If the UDS clients are encoding the header value, then we can be both spec-compliant and support UDS. @blowdart If you have concerns there though, I like the idea of doing path-style validation when listening on a UDS. |
Related to the issue, please consider esoteric Windows named pipes values for when Kestrel is using that transport. https://docs.microsoft.com/en-us/windows/win32/ipc/pipe-names |
Can we iterate through transports, and have transports decide if the host header is valid for them? That seems a better approach than either on or off. |
This may relate to proposed work on Named Pipes, so @Tratcher can take a look for now |
Is there any design decision made? Would need it badly for my kubernetes CSI plugin, |
@Zetanova even when we do this, it will only be for .NET 5. In the meantime you're going to need a different solution. |
Planning notes: We'll look at allowing validation to be disabled when using UDS. Targeting 5.0, but not the immediate next preview and may be punted. It must be configurable per-endpoint. |
I've experimented with gRPC over unix domain sockets with Grpc.Net.Client (using HttpClient) calling Grpc.AspNetCore (using Kestrel). HttpClient will always send a valid host header, even when using a different transport. It is a hard requirement of using HttpClient. I recommend moving this issue to future milestone. We can judge whether it is needed based on additional demand. |
A workaround is to use golang as a sidecar/reverse proxy to overwrite the host header. It is the only way that i found to use dotnet-kestrel for kubelet/kubernetes plugins over UDS |
I looked into this more. go-grpc's behavior of sending the file path has been causing problems for other servers like nodejs. See grpc/grpc-go#2628 go-grpc has recently been updated to send "localhost" as the authority with unix domain sockets. See grpc/grpc-go#3730. The fix is in 1.31 which is available today. Upgrade to it and retry? I think Kestrel is doing the right thing here. |
@JamesNK thx for the good news. Because kubernetes/kubelet is the gRPC-client, |
Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue. This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue! |
It appears some HTTP clients (in particular gRPC clients) that connect over Unix Domain Sockets put the path to the socket in the
Host
header. We should investigate this a little bit. If it's the case that most clients do this, we should consider having an option to allow disablingHost
header validation. We could limit this to only cases where we're listening on a Unix Socket to reduce security risk.The text was updated successfully, but these errors were encountered: