gRPC for Dart 5.2
Last reviewed Oct 26, 2026
Prompt Details
Prompt Composition
2prompts
- Dart 3.13109 lines · 2.9K tokens
- gRPC for Dart 5.245 lines · 2.3K tokens
Total154 lines · 5.3K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 201
- 209
- 287
- 288
- 295
- 297
- 319
- 323
- 338
- 352
- 362
- 367
- 377
- 426
- 436
- 532
- 598
- 602
- 613
- 636
- 639
- 674
- 704
- 770
- 772
- 798
- 807
- 862
- 863
- 915
- 918
- 922
- 940
- 942
- 1333
- 1395
Prompt Preview
Apply these rules to the grpc package's 5.2 release line on native Dart, Flutter, and its gRPC-Web client. The Dart baseline applies first.
Transport and peer identity
- Expose a network-facing
ServerwithServer.serve(address: ..., security: ServerTlsCredentials(...))or a trusted TLS terminator, supplying a server certificate and private key. An omittedaddressbinds all IPv4 interfaces, and a listener withoutsecurityis cleartext; keep any cleartext backend unreachable except from its terminator. - Bind local-only servers to
InternetAddress.loopbackIPv4,loopbackIPv6, or a protected Unix socket. Do not rely onServerLocalCredentialsor an overriddenvalidateClientto reject remote peers: the socket accept path does not invoke that method. - Where client certificates identify callers, use a
ServerCredentials.securityContextthat trusts the intended client CAs, require client certificates withServer.serve(requireClientCertificate: true), and map the verifiedServiceCall.clientCertificateto an application principal.requestClientCertificatealone permits clients without certificates.ChannelCredentials.secure(certificates: ...)configures client trust roots, not a client certificate. - Use the default secure
ChannelOptions.credentialsorChannelCredentials.securewith trusted roots and the expected server name. KeepChannelCredentials.insecureon isolated local or separately protected links. Never setonBadCertificateto accept arbitrary certificates or callallowBadCertificatesin deployed code; do not pointauthorityat a