Connect for Go 2
Last reviewed Oct 25, 2026
Prompt Details
Prompt Composition
2prompts
- Go 1.27130 lines · 5.5K tokens
- Connect for Go 253 lines · 2.4K tokens
Total183 lines · 7.9K 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/v2, including its connecthttp and connectinprocess transports and the Protobuf APIv2 runtime.
Routing, authentication, and authorization
- Register only intended procedures on
connect.NewServer; review every generatedRegister...Handlercall beforeconnecthttp.Mount. Treat separately mounted health, reflection, and administrative handlers as separate authorization surfaces. - Authenticate protected RPCs in a
connect.ServerInterceptorbefore callingnext. Get theCallInfowithconnect.CallInfoForServerContext(ctx), read itsRequestHeader(), and verify the credentials; a nonempty header orCallInfo.PeerAddris not an identity. A v2 server interceptor runs before request decompression and decoding. - Authorize
spec.Procedureand the requested resource for the current principal. For client or bidirectional streams, validate and authorize each message before its side effects; accepting the stream does not authorize later resource identifiers. - Apply security interceptors to the
connect.NewServerused by every transport.connectinprocess.New(server)runs server interceptors but bypasses HTTP middleware, CORS, TLS, andconnecthttp.Mountoptions. Do not make HTTP-only controls the sole protection for an in-process or custom transport. - Keep the default
CodeUnimplementedfallback unless a proxy needsServer.SetUnknownHandler. If installing a fallback, reject unauthorized procedures and bound its input: unknown procedures have no schema and are treated as