golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.59k stars 17.61k forks source link

x/net/http2: Expose isBadCipher #30407

Open jefferai opened 5 years ago

jefferai commented 5 years ago
$ go 1.11.5

When manually specifying server ciphers, it is possible to specify a set of valid TLS 1.2 ciphers that are blacklisted in the HTTP/2 spec. This is a known potential issue; from the spec section 9.2.2:

The black list includes the cipher suite that TLS 1.2 makes mandatory, which means that TLS 1.2 deployments could have non-intersecting sets of permitted cipher suites. To avoid this problem causing TLS handshake failures, deployments of HTTP/2 that use TLS 1.2 MUST support TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 [TLS-ECDHE] with the P-256 elliptic curve [FIPS186].

Although this is in theory enough to prevent handshake failures, highly security conscious/paranoid users may not want to (or be allowed to) use RSA and want further control over exactly which ciphers are in use.

There is an isBadCipher function in the package that in theory could be used to check whether a user's submitted set of ciphers will cause blacklisting issues when using HTTP/2, however since it's not exported client code cannot use it to perform a simple check when evaluating a client's chosen cipher suites.

This is a simple request to expose that function. There is no obvious reason why the behavior of that function should ever change outside of a spec revamp, so it seems fairly safe to do so.

bcmills commented 5 years ago

CC @bradfitz @tombergan @FiloSottile

FiloSottile commented 5 years ago

What's the intended use case for this? Checking if user-configured ciphers are ok to use with HTTP/2? Would a "HTTP2BadCipher" field in the CipherSuite struct in https://github.com/golang/go/issues/30325#issuecomment-483863377 work?

bradfitz commented 5 years ago

@FiloSottile, putting HTTP/2-specific details in a non-http2 package sounds gross.

I'm fine exporting a func in x/net/http2. It's already full of http2-specific gunk.