Connect for Go 1.20.0
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- Go 1.27130 lines · 5.5K tokens
- Connect for Go 1.20.057 lines · 2.7K tokens
Total187 lines · 8.2K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 250
- 252
- 257
- 287
- 288
- 295
- 307
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 426
- 444
- 488
- 494
- 524
- 532
- 598
- 639
- 732
- 759
- 770
- 772
- 807
- 862
- 915
- 916
- 918
- 942
- 1004
- 1275
- 1395
- 1428
Prompt Preview
Apply the Go 1.27 baseline first. These rules cover connectrpc.com/connect v1.20.0 with the google.golang.org/protobuf APIv2 runtime. The module requires Go 1.25 or newer; use a supported, patched Go toolchain matching the included baseline.
Handlers and authorization
- Authenticate protected RPCs in
net/httpmiddleware before invoking the Connect handler. Unary interceptors run after reading, decompressing, and decoding the request, so they cannot protect that work from unauthenticated callers.WithRequestGateis unavailable in 1.20.0. - Apply shared security options to every generated
New...Handler. ImplementInterceptor.WrapStreamingHandlerfor streaming policy:UnaryInterceptorFuncaffects only unary calls, including when a service also has server-streaming methods. - Authorize the generated procedure identified by
Spec().Procedureand each referenced resource against the authenticated principal. Validate and authorize each received streaming operation before its side effects; opening an authorized stream does not grant access to every object later named on it. - Review
WithInterceptorsorder: the first interceptor is outermost, and streaming receive wrappers see decoded messages in the reverse of the send order. Keep required controls on every procedure when usingWithConditionalHandlerOptions; unmatched procedures must retain authentication, authorization, and size limits. - Enforce the same policy across Connect, gRPC, gRPC-Web, binary Protobuf, and JSON, all supported by default on handlers. Client options such as
WithGRPC()select a