gRPC Python 1.84
Last reviewed Oct 24, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3155 lines · 3.8K tokens
- gRPC Python 1.8452 lines · 2.4K tokens
Total207 lines · 6.2K tokens
CWE Coverage
- 20
- 23
- 36
- 59
- 78
- 89
- 95
- 117
- 208
- 209
- 214
- 250
- 295
- 306
- 319
- 328
- 338
- 347
- 367
- 379
- 409
- 416
- 426
- 427
- 470
- 497
- 502
- 532
- 611
- 674
- 732
- 770
- 772
- 776
- 807
- 829
- 862
- 916
- 918
- 941
- 1104
- 1333
- 1395
Prompt Preview
Apply the Python 3 baseline first. These rules cover grpcio 1.84 synchronous and AsyncIO services and clients.
Transport and destination trust
- Create network clients with
grpc.secure_channel()orgrpc.aio.secure_channel()andgrpc.ssl_channel_credentials(). Serve withadd_secure_port()andgrpc.ssl_server_credentials(); keepinsecure_channel()andadd_insecure_port()off untrusted networks. If TLS terminates at a proxy, use a gRPC-aware boundary, protect the backend hop and accept asserted identities only from authenticated, trusted proxies. - For mutual TLS, supply trusted client roots and set
require_client_auth=True; its default is false. Map verifiedServicerContext.peer_identities()andauth_context()values to application principals. Never authenticate frompeer()addresses or caller-supplied identity metadata. - Retain certificate and hostname verification. Do not use
grpc.ssl_target_name_overrideto make a mismatched certificate pass. Protect private keys and the configured root bundle; do not add arbitrary roots to repair a connection. Keep keys and bearer credentials out of channel targets, logs and exception text. - Rotate certificates and credentials without falling back to insecure transport. For server certificate reloads, use a controlled
dynamic_ssl_server_credentials()fetcher returningssl_server_certificate_configuration()and retainrequire_client_authentication=Truewhen mutual TLS is required; returningNonekeeps the current configuration. Test reload failures and expiration. - With
root_certificates=None,