gRPC for .NET 2.84
Last reviewed Oct 18, 2026
Prompt Details
Prompt Composition
3prompts
- C# 14106 lines · 4.4K tokens
- ASP.NET Core 10.065 lines · 3.5K tokens
- gRPC for .NET 2.8448 lines · 2.6K tokens
Total219 lines · 10.4K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 89
- 94
- 117
- 190
- 208
- 209
- 214
- 257
- 295
- 307
- 312
- 319
- 323
- 327
- 338
- 352
- 362
- 367
- 378
- 426
- 434
- 488
- 502
- 524
- 525
- 532
- 552
- 601
- 611
- 613
- 614
- 636
- 639
- 674
- 759
- 770
- 772
- 775
- 778
- 798
- 807
- 862
- 915
- 916
- 918
- 942
- 1004
- 1275
- 1333
- 1385
- 1395
Prompt Preview
Apply these rules to the managed Grpc.Net.Client and Grpc.AspNetCore.Server stack on .NET 10, after the ASP.NET Core 10.0 prompt and its C# 14 baseline. Apply the browser rules when enabling gRPC-Web or ASP.NET Core JSON transcoding.
Channels and credentials
- Create production
GrpcChannelinstances with trusted HTTPS addresses and serve gRPC on TLS endpoints. Authenticate and encrypt the proxy-to-service hop too; TLS termination at the edge does not protect that hop. - Keep
UnsafeUseInsecureChannelCallCredentialsfalse. Its guard applies toCallCredentials, not arbitrary headers: never send credentials over plaintext throughMetadata,HttpClient.DefaultRequestHeaders, interceptors, or delegating handlers. - Resolve per-user credentials inside
AddCallCredentialsorCallCredentials.FromInterceptor, honorAuthInterceptorContext.CancellationToken, and select tokens for the intended downstream audience. Never capture one request's token in a shared channel, singleton interceptor, or pooled handler, or blindly forward incoming authorization metadata. - For SSRF prevention, choose channel addresses, resolver schemes, authorities, and ports from administrator-controlled configuration. Validate every destination produced by a custom resolver against the permitted service network and enforce that policy at egress; a trusted resolver name alone does not authorize its addresses. For
dns:///andstatic:///channels, setCredentials = ChannelCredentials.SecureSslexplicitly. SetDisableResolverServiceConfig = trueunless the resolver is trusted to