Skip to content

Commit

Permalink
chore: add a flag to disable htttp2
Browse files Browse the repository at this point in the history
This is to mitigate CVE-2023-44487
until the Go standard library and golang.org/x/net
are fully fixed.

Signed-off-by: Jayapriya Pai <janantha@redhat.com>
  • Loading branch information
slashpai committed Nov 15, 2023
1 parent d7f6d5b commit 7f8dd2e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/metrics-server/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ type Options struct {
ShowVersion bool
Kubeconfig string

// DisableHTTP2 indicates that http2 should not be enabled.
DisableHTTP2 bool

// Only to be used to for testing
DisableAuthForTesting bool
}
Expand Down Expand Up @@ -79,6 +82,7 @@ func (o *Options) Flags() (fs flag.NamedFlagSets) {
msfs.DurationVar(&o.MetricResolution, "metric-resolution", o.MetricResolution, "The resolution at which metrics-server will retain metrics, must set value at least 10s.")
msfs.BoolVar(&o.ShowVersion, "version", false, "Show version")
msfs.StringVar(&o.Kubeconfig, "kubeconfig", o.Kubeconfig, "The path to the kubeconfig used to connect to the Kubernetes API server and the Kubelets (defaults to in-cluster config)")
msfs.BoolVar(&o.DisableHTTP2, "disable-http2", true, "Disable HTTP/2 support")

o.KubeletClient.AddFlags(fs.FlagSet("kubelet client"))
o.SecureServing.AddFlags(fs.FlagSet("apiserver secure serving"))
Expand Down Expand Up @@ -135,6 +139,10 @@ func (o Options) ApiserverConfig() (*genericapiserver.Config, error) {
return nil, err
}

// disable HTTP/2 to mitigate CVE-2023-44487 until the Go standard library
// and golang.org/x/net are fully fixed.
serverConfig.SecureServing.DisableHTTP2 = o.DisableHTTP2

if !o.DisableAuthForTesting {
if err := o.Authentication.ApplyTo(&serverConfig.Authentication, serverConfig.SecureServing, nil); err != nil {
return nil, err
Expand Down

0 comments on commit 7f8dd2e

Please sign in to comment.