Repository navigation
Conversation
5f884e5 to
23d723d
Compare
25e7a23 to
ffa67d0
Compare
| // Native gRPC bypasses the daemon's HTTP authorization middleware. | ||
| // Keep it opt-in until Moby enforces authorization on that path. | ||
| enabled, _ := strconv.ParseBool(os.Getenv("BUILDX_DOCKER_NATIVE_GRPC")) |
There was a problem hiding this comment.
Native gRPC currently bypasses Moby's authorization plugins. httpHandler.ServeHTTP dispatches gRPC requests directly to the gRPC server or extension proxy, bypassing the HTTP API handler where the authorization middleware is registered. Consequently, these requests do not pass through its AuthZRequest check.
This is why native gRPC remains opt-in here. Moby needs to enforce authorization before dispatching native RPCs, covering both local services and the extension proxy while preserving streaming behavior. Keeping Buildx on the legacy transport by default preserves its existing authorization path, but doesn't prevent other clients from accessing the daemon's native gRPC endpoint.
There was a problem hiding this comment.
The /grpc endpoint is deprecated; no need to make it opt-in. Buildx isn't responsible for protecting the API because anything already can do.
There was a problem hiding this comment.
Removed the opt-in. I kept the DialMeta guard because Desktop uses X-Docker-Desktop-idle: background on the /grpc upgrade to let Resource Saver distinguish background connections from interactive builds (https://github.com/docker/desktop-build/pull/312). That's separate from Moby's authorization middleware. These clients retain the legacy transport until equivalent native gRPC behavior is supported and verified.
ffa67d0 to
77cf029
Compare
Automatically probe native gRPC support on Unix sockets and named pipes. Share a bounded probe across concurrent callers and keep failed or canceled probes retryable. Retain the legacy transport for remote endpoints and daemons without native gRPC support. Return explicit authentication and authorization failures without falling back. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
77cf029 to
b4e8db3
Compare
|
@tonistiigi I benchmarked the legacy transport against the native gRPC path introduced by moby/moby#50744 to address moby/moby#49836. Your concern about session performance is reproducible. The comparison uses the same Engine 29.3.0 daemon and client dependencies: legacy Transfer results below are medians of five measured runs after warmup, with execution order rotated and all exported contents verified. Each workload includes both uploading the files and exporting them locally.
Allocated bytes are cumulative allocations, not peak memory usage. Control latency during transfers is the median of each run's p95. The small-file elapsed ranges overlap, so I wouldn't treat the 3.7% difference as a confirmed latency regression. The CPU and allocation increases are the stronger signal. The native path drops the explicit session dialer, making BuildKit tunnel the session through These are focused local transport measurements, not full build benchmarks. Shared Bake sessions already use tunneling in some cases, so the results don't apply uniformly to every Bake workload. Daemon CPU/memory, high-concurrency behavior, remote endpoints, and Desktop wake/sleep behavior remain outside this benchmark. |
Automatically use native gRPC for supported Docker daemons over Unix sockets and named pipes, using the daemon support introduced in moby/moby#50744. Retain the legacy
/grpcand/sessiontransport for remote endpoints and daemons without native gRPC support, preserving Docker's existing TLS and SSH handling. Concurrent callers share a bounded capability probe, and failed or canceled probes remain retryable. Explicit authentication and authorization failures are returned without falling back.