Go net/http 1.27
Last reviewed Oct 11, 2026
Prompt Details
Prompt Composition
2prompts
- Go 1.27130 lines · 5.5K tokens
- Go net/http 1.2772 lines · 3.9K tokens
Total202 lines · 9.3K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 89
- 94
- 117
- 190
- 208
- 209
- 250
- 252
- 257
- 287
- 295
- 307
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 384
- 426
- 444
- 488
- 494
- 525
- 532
- 552
- 601
- 613
- 639
- 732
- 759
- 770
- 772
- 807
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1021
- 1275
- 1395
- 1428
Prompt Preview
Apply the Go 1.27 prompt first. These rules cover the Go 1.27 standard-library HTTP server, client, router, file handlers, and reverse proxy. The standard library is updated by rebuilding with the toolchain; the included baseline governs its security updates.
Server limits and protocols
- Assign an explicit, fully wrapped handler to
Server.Handler; nil selectsDefaultServeMux, including routes registered by imported packages. Keep administrative handlers on a separately restricted listener. - Size
MaxHeaderBytesandMaxHeaderValueCountindependently: zero selects defaults of 1 MiB and 500 values. Repeated header lines count separately, but comma-separated members of one line count once, except that Go 1.27.2 and later count each field aTrailerheader declares; validate security-sensitive singleton headers separately. - Configure
Server.ProtocolsandTransport.Protocolsdeliberately. EnableSetUnencryptedHTTP2(true)only on an explicitly trusted, isolated connection path; it supplies neither TLS nor peer authentication. Review customTLSNextProtoandConnectionState() tls.ConnectionStateimplementations because they affect ALPN protocol selection. - Configure HTTP/2 through the native
ProtocolsandHTTP2ConfigAPIs where possible. Ifgolang.org/x/net/http2remains, audit both the module and the toolchain and check which implementation the build selects: current Go 1.27 wrappers delegate tonet/http, whilehttp2legacyand older module implementations need their own fixes. Replace deprecatedh2c.NewHandlerwithServer.Protocols; wrap