Skip to content

Send an :authority on the vminitd gRPC connection - #989

Merged
jglogan merged 1 commit into
apple:mainfrom
jglogan:vminitd-grpc-authority
Oct 24, 2026
Merged

jglogan merged 1 commit into
apple:mainfrom
jglogan:vminitd-grpc-authority

Conversation

@jglogan

@jglogan jglogan commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Vminitd connects to the guest agent by wrapping an already-connected vsock with HTTP2ClientTransport.WrappedChannel.wrapping(...). There is no target address to derive an :authority from and Config.http2.authority defaults to nil, so the client sends requests with no :authority header.

This sets http2.authority explicitly, keeping the existing connection.maxIdleTime = nil setting. The configuration is factored into Vminitd.transportConfig() so it can be tested.

This is precautionary, not a bug fix

The guest agent is served by grpc-swift, which does not reject requests without an :authority, so nothing is broken today. The reason to do this is that grpc-go v1.82.2, v1.83.2 and v1.84.0 and later do reject them with Internal: "no host or :authority header present" (grpc/grpc-go#9365). A client that wraps a pre-connected socket the way this one does stops working against any server that enforces it. apple/container hit this with its builder shim, which is a grpc-go server (apple/container#2428 sets an authority there). Sending one here keeps this client compatible if the server stack changes, and the tests stop the configuration from silently returning to the defaults.

The authority value is not significant: the agent does not route on it and there is no TLS. "vminitd" is a valid host name.

Testing

Added VminitdTransportConfigTests:

  • the transport configuration carries a non-empty :authority;
  • the idle timeout stays disabled (the connection to the guest agent is long-lived), since it shares the configuration that changed.

Both pass with swift test --filter VminitdTransportConfigTests. I have not run a full container workload through the changed client, so the effect on a live vminitd connection is untested; grpc-swift servers do not validate the header, so I expect none.

The guest agent connection wraps an already-connected vsock, so
grpc-swift has no target address to derive an :authority from and sends
none. The guest agent does not require one, but gRPC-Go v1.82.2, v1.83.2
and v1.84.0 reject requests without an :authority (grpc-go #9365), so
send one to stay compatible with servers that enforce it.

Set http2.authority explicitly, keeping the existing idle-timeout
setting. Factor the configuration into Vminitd.transportConfig() and
add tests so neither setting silently returns to the defaults.

This is precautionary: the vminitd server is grpc-swift, which does not
reject requests without an :authority.
@jglogan
jglogan merged commit 72298de into apple:main Oct 24, 2026
7 checks passed
@jglogan
jglogan deleted the vminitd-grpc-authority branch October 24, 2026 00:08
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