gRPC for PHP 1.83
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.5145 lines · 5.4K tokens
- gRPC for PHP 1.8357 lines · 2.5K tokens
Total202 lines · 8K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 98
- 117
- 187
- 201
- 208
- 209
- 214
- 252
- 256
- 295
- 297
- 319
- 323
- 338
- 340
- 352
- 354
- 367
- 384
- 390
- 409
- 434
- 470
- 502
- 522
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 732
- 770
- 772
- 776
- 798
- 807
- 829
- 837
- 862
- 915
- 916
- 918
- 940
- 1004
- 1275
- 1333
- 1395
Prompt Preview
Apply the PHP 8.5 baseline first. These rules cover outbound clients using the 1.83 line of the grpc/grpc Composer package and native grpc extension. Apply server authentication and authorization in the receiving service's implementation; a PHP client stub cannot enforce them for the server.
Runtime and generated code
- Verify the locked Composer package, the loaded extension version with
phpversion('grpc')in the deployed SAPI, and the Core version bundled or linked by the extension build; updating Composer alone does not update the native transport. Test the extension with the actual PHP 8.5 build and worker mode. - Declare and lock the protobuf runtime used by generated messages, whether
google/protobuforext-protobuf, and declaregoogle/authwhen used. Generate reviewed schemas with pinnedprotocandgrpc_php_plugintooling; never pair newer generated code with an older protobuf runtime.
Channels, destinations, and TLS
- Pass
'credentials' => Grpc\ChannelCredentials::createSsl($trustedRootsPem)for remote services.createInsecure()returnsnull, and a rawGrpc\Channelwith missing or null credentials is plaintext; confine these paths to isolated tests and fail on TLS errors without falling back. - Supply trusted PEM contents, not filenames, to
createSsl; supply both private key and certificate chain for mutual TLS. EstablishChannelCredentials::setDefaultRootsPem()only from trusted startup configuration; its default-root state is process-wide, not tenant-local. - Keep
grpc.ssl_target_name_overrideout of production settings and