Skip to content

Commit

Permalink
Merge pull request #522 from cgoncalves/CVE-2023-44487
Browse files Browse the repository at this point in the history
webhook: Disable HTTP2 by default
  • Loading branch information
Eoghan Russell authored Oct 24, 2023
2 parents 10a8201 + 2eefedb commit de7945c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/webhook/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (
)

var (
certFile string
keyFile string
port int
certFile string
keyFile string
port int
enableHTTP2 bool
)

var (
Expand Down Expand Up @@ -48,6 +49,7 @@ func init() {
"File containing the default x509 private key matching --tls-cert-file.")
startCmd.Flags().IntVar(&port, "port", 443,
"Secure port that the webhook listens on")
startCmd.Flags().BoolVar(&enableHTTP2, "enable-http2", false, "If HTTP/2 should be enabled for the metrics and webhook servers.")
}

// serve handles the http portion of a request prior to handing to an admit
Expand Down Expand Up @@ -152,6 +154,11 @@ func runStartCmd(cmd *cobra.Command, args []string) {
TLSConfig: &tls.Config{
GetCertificate: keyPair.GetCertificateFunc(),
},
// CVE-2023-39325 https://github.com/golang/go/issues/63417
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)),
}
if enableHTTP2 {
server.TLSNextProto = nil
}
err := server.ListenAndServeTLS("", "")
if err != nil {
Expand Down

0 comments on commit de7945c

Please sign in to comment.