gRPC for Dart 5.0
Last reviewed Sep 20, 2026
Prompt Details
Prompt Composition
2prompts
- Dart 3.13109 lines · 2.9K tokens
- gRPC for Dart 5.0108 lines · 4.6K tokens
Total217 lines · 7.6K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 113
- 209
- 287
- 288
- 295
- 297
- 307
- 319
- 323
- 338
- 347
- 352
- 362
- 367
- 377
- 426
- 436
- 532
- 598
- 602
- 613
- 636
- 639
- 704
- 770
- 772
- 798
- 807
- 863
- 915
- 918
- 922
- 940
- 942
- 1333
- 1395
Prompt Preview
Apply the Dart 3.13 prompt first. These rules cover the gRPC-Dart 5.0 release line: native listeners and clients, browser gRPC-Web clients, and custom transports. They were checked against the published 5.0.0 package. That package declares Dart >=3.8.0 <4.0.0, protobuf: ^5.1.0, and http2: ^2.3.1; do not import options or guarantees from gRPC Core or newer Dart packages.
Listener and transport boundaries
- Register only intended services through
Server.createand pass an explicitaddress,port,security, andhttp2ServerSettingstoServer.serve; omittingaddressbinds all IPv4 interfaces and a null security context creates a plaintext listener. Retain the defaultshared: falseunless shared binding is intentional. - For a local-only service, bind an explicit loopback address or a Unix-domain socket inside a permission-restricted directory and test that non-local peers cannot connect.
- Do not rely on
ServerLocalCredentialsfor locality in 5.0.0:Server.serveuses its nullsecurityContextto create a plaintext socket and does not callServerCredentials.validateClient. - Put an externally reachable listener behind a gRPC-aware ingress with authentication, connection and stream admission limits, and an explicit route allowlist; prevent direct access around that ingress.
- Treat
ConnectionServerandClientTransportConnectorChannelas raw trust-boundary APIs: authenticate and encrypt the supplied transport and deriveclientCertificate,remoteAddress, target, and authority only from verified transport state. Setting secure