gRPC for Dart 5.2

Last reviewed Oct 26, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Dart 3.13109 lines · 2.9K tokens
  2. 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 Server with Server.serve(address: ..., security: ServerTlsCredentials(...)) or a trusted TLS terminator, supplying a server certificate and private key. An omitted address binds all IPv4 interfaces, and a listener without security is 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 on ServerLocalCredentials or an overridden validateClient to reject remote peers: the socket accept path does not invoke that method.
  • Where client certificates identify callers, use a ServerCredentials.securityContext that trusts the intended client CAs, require client certificates with Server.serve(requireClientCertificate: true), and map the verified ServiceCall.clientCertificate to an application principal. requestClientCertificate alone permits clients without certificates. ChannelCredentials.secure(certificates: ...) configures client trust roots, not a client certificate.
  • Use the default secure ChannelOptions.credentials or ChannelCredentials.secure with trusted roots and the expected server name. Keep ChannelCredentials.insecure on isolated local or separately protected links. Never set onBadCertificate to accept arbitrary certificates or call allowBadCertificates in deployed code; do not point authority at a