Repository navigation
feat(core)!: serve platform services on connect-go v2 and authenticate before decoding - #4216
alkalescent wants to merge 14 commits into
Conversation
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
connect-go v2 and the matching otelconnect, validate, grpchealth, and grpcreflect releases require Go 1.26. Go 1.25 is no longer supported upstream. Other modules keep their go directives. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
otelconnect v0.12.0 serves both connect-go v1 and v2. It removes WithoutTraceEvents and WithoutServerPeerAttributes because both behaviors are now the default, follows OpenTelemetry RPC semantic conventions v1.43.0, and records one rpc.server.call.duration metric. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
buf.gen.connectv2.yaml generates connect-go v2 service stubs into service/internal/connectv2 with the connectv2 package suffix. They import the messages from protocol/go, so protocol/go and its consumers are unchanged. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
… connect-go versions Authorization resolvers receive the decoded request message instead of a connect-go v1 request, and the IPC, audit, and client IP interceptors move their logic into helpers that take plain headers and peer addresses. Behavior is unchanged. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Adds connect-go v2 forms of the authentication, authorization, IPC, client IP, audit, tracing, and validation interceptors. v2 runs server interceptors before it reads the request body, so authentication uses only the headers. Authorization reads the message first only for unary procedures with a registered resource resolver, and the handler receives that message unchanged. connectcompat sends handler errors with the code, message, details, and metadata that connect-go v1 sent, and its CodeOf reads codes from both versions. ReadLimitMountOptions caps v2 request messages and bounds gzip decompression at the same limit. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Services can set ConnectRPCRegisterFunc to serve on connect-go v2 instead of ConnectRPCFunc, with ConnectRPCMountOptions for HTTP options such as read limits. Each v2 service gets its own server per mux with the platform's v2 interceptors, so v1 and v2 services share the external and in-process servers. External v2 services default to server.grpc.maxRecvMsgSize; in-process v2 services keep unlimited reads. WithConnectServerInterceptors, WithIPCServerInterceptors, and InterceptorFactory.ServerFactory take interceptors in both connect-go forms. A service cannot be registered while an extra interceptor lacks the form for its version, and startup fails, so an interceptor is never skipped. WithConnectInterceptors and WithIPCInterceptors are deprecated. BREAKING CHANGE: startup fails when an interceptor passed through WithConnectInterceptors, WithIPCInterceptors, or a factory without ServerFactory would not cover a connect-go v2 service. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Policy, authorization, entity resolution, KAS, well-known configuration, and health now register on connect-go v2 with the generated v2 stubs. Handlers take and return plain messages. Code that reads codes from SDK errors uses connectcompat.CodeOf, and connectcompat keeps the errors clients receive unchanged. BREAKING CHANGE: handler methods of platform services, including the exported entity resolution implementations, take and return plain messages instead of connect.Request and connect.Response, and the health registration uses connectrpc.com/grpchealth/v2. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
… limits Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
|
Important Review skippedToo many files! This PR contains 115 files, which is 15 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configuration
⛔ Files ignored due to path filters: 2
📒 Files selected for processing: 115
You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
…uest-gate Signed-off-by: Krish Suchak <suchak.krish@gmail.com> # Conflicts: # docs/Configuring.md # service/internal/server/connect_limits.go # service/internal/server/connect_limits_test.go # service/internal/server/server.go # service/wellknownconfiguration/wellknown_configuration_test.go
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
…uest-gate Rewrap reads key lookup error codes with connectcompat.CodeOf because SDK errors are connect-go v1, and the new Rewrap tests call the v2 handler signature. Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
|
Proposed Changes
Depends on #4237. After that
protocol/gorelease, this PR imports the v2 stubs fromprotocol/goand dropsservice/internal/connectv2andbuf.gen.connectv2.yaml.ConnectAuthNInterceptorskips authentication after the gate because validating the same DPoP proof twice tripsjtireplay detection. connect-go v2 runs server interceptors before it reads the body, so v2 services authenticate inConnectAuthNInterceptorV2. Both read the HTTP method for DPoPhtmbinding.service/internal/connectv2(buf.gen.connectv2.yaml, package suffixconnectv2), soprotocol/goand the SDK stay on connect-go v1 and do not change.ConnectRPCRegisterFunc(v2) next toConnectRPCFunc(v1), so services built on the platform can move one at a time. Each v2 service gets its own server per mux with v2 forms of the authentication, authorization, IPC, client IP, validation, audit, and tracing interceptors. Authorization reads the request first only for unary procedures with a resource resolver and hands the same message to the handler; resolvers now receive the decodedproto.Message.*connect.Errorvalues as written.connectcompat.ServerInterceptorsends every other error, including errors from SDK calls anddb.StatusifyError, with the code, message, details, and metadata connect-go v1 sent, andconnectcompat.CodeOfreads codes from both versions where handlers inspect SDK errors. The v2 validation interceptor returns the same message and violations asconnectrpc.com/validatev0.6.0; validate releases that support v2 require protovalidate 1.4, which changes validation error messages.server.grpc.maxRecvMsgSizefrom fix(core): limit request message size on external Connect handlers #4215, with gzip decompression bounded at the same limit. Services set their own limits withConnectRPCMountOptions,ConnectReadLimitOptions, andConnectProcedureReadLimits. In-process calls stay unlimited, as on v1. The gzip bound no longer overflows when the limit ismath.MaxInt64, so requests at that limit are accepted on v1 and v2.WithConnectServerInterceptors,WithIPCServerInterceptors, andInterceptorFactory.ServerFactorytake an interceptor's v1 and v2 forms. A service cannot be registered while an extra interceptor lacks the form for its version, and startup fails, so an interceptor never silently skips a service.WithConnectInterceptorsandWithIPCInterceptorsare deprecated.WithRequestGate, and per chore(ci): limit dependabot version updates on published modules to internal deps #4129 the bump is limited toservice/go.mod; it covers theservicepart of fix(deps): bump the external group across 1 directory with 36 updates #4124. connect-go v2,grpchealth/v2, and otelconnect v0.12.0 require Go 1.26, sogo.workandservice/go.modmove to Go 1.26. Other modules keep their Go versions.Breaking changes:
servicerequires Go 1.26.WithConnectInterceptors,WithIPCInterceptors, or a factory withoutServerFactoryis used, because those interceptors cannot run on the v2 platform services.connectrpc.com/grpchealth/v2.proto.Messageinstead ofconnect.AnyRequest.rpc.server.call.durationmetric.Behavior changes:
WWW-Authenticatefrom the trailers that carry gRPC error metadata.Services that stay on
ConnectRPCFunckeep working behind the gate and read limit, but any extra interceptors they install need a v2 form. Generated code sits in its own commit.Checklist
Testing Instructions