Skip to content

Commit

Permalink
Mark UseLocalHostAsDefaultHostfeatureGate as stable (#11235)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Sep 23, 2024
1 parent 66f41f9 commit fe10446
Show file tree
Hide file tree
Showing 22 changed files with 59 additions and 175 deletions.
20 changes: 20 additions & 0 deletions .chloggen/stable-localhost.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'breaking'

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: config

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Mark UseLocalHostAsDefaultHostfeatureGate as stable

# One or more tracking issues or pull requests related to the change
issues: [11235]

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
9 changes: 0 additions & 9 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import (
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/extension/auth"
"go.opentelemetry.io/collector/extension/auth/authtest"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/internal/globalgates"
"go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp"
)

Expand Down Expand Up @@ -533,13 +531,6 @@ func TestUseSecure(t *testing.T) {
}

func TestGRPCServerWarning(t *testing.T) {
prev := globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled()
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, false))
defer func() {
// Restore previous value.
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, prev))
}()

tests := []struct {
name string
settings ServerConfig
Expand Down
7 changes: 0 additions & 7 deletions config/configgrpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ require (
go.opentelemetry.io/collector/config/configtls v1.15.0
go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b
go.opentelemetry.io/collector/extension/auth v0.109.0
go.opentelemetry.io/collector/featuregate v1.15.0
go.opentelemetry.io/collector/internal/globalgates v0.109.0
go.opentelemetry.io/collector/pdata v1.15.0
go.opentelemetry.io/collector/pdata/testdata v0.109.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0
Expand All @@ -34,7 +32,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand Down Expand Up @@ -77,8 +74,6 @@ replace go.opentelemetry.io/collector/extension => ../../extension

replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/featuregate => ../../featuregate

replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
Expand All @@ -89,8 +84,6 @@ replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates

replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal

replace go.opentelemetry.io/collector/pipeline => ../../pipeline
2 changes: 0 additions & 2 deletions config/configgrpc/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions config/confighttp/confighttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import (
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/extension/auth"
"go.opentelemetry.io/collector/extension/auth/authtest"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/internal/globalgates"
)

type customRoundTripper struct {
Expand Down Expand Up @@ -520,13 +518,6 @@ func TestHTTPServerSettingsError(t *testing.T) {
}

func TestHTTPServerWarning(t *testing.T) {
prev := globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled()
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, false))
defer func() {
// Restore previous value.
require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, prev))
}()

tests := []struct {
name string
settings ServerConfig
Expand Down
7 changes: 0 additions & 7 deletions config/confighttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ require (
go.opentelemetry.io/collector/config/configtls v1.15.0
go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b
go.opentelemetry.io/collector/extension/auth v0.109.0
go.opentelemetry.io/collector/featuregate v1.15.0
go.opentelemetry.io/collector/internal/globalgates v0.109.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0
go.opentelemetry.io/otel v1.30.0
go.opentelemetry.io/otel/metric v1.30.0
Expand All @@ -34,7 +32,6 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector/extension v0.109.0 // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.0.0-20240923154032-388e56cdb156 // indirect
Expand Down Expand Up @@ -68,8 +65,6 @@ replace go.opentelemetry.io/collector/extension => ../../extension

replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/featuregate => ../../featuregate

replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/component => ../../component
Expand All @@ -82,8 +77,6 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates

replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal

replace go.opentelemetry.io/collector/pipeline => ../../pipeline
2 changes: 0 additions & 2 deletions config/confighttp/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions config/internal/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@ go 1.22.0

require (
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector/internal/globalgates v0.109.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
go.opentelemetry.io/collector/featuregate v1.15.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates

replace go.opentelemetry.io/collector/featuregate => ../../featuregate
8 changes: 6 additions & 2 deletions config/internal/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions config/internal/warning.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"strings"

"go.uber.org/zap"

"go.opentelemetry.io/collector/internal/globalgates"
)

func shouldWarn(endpoint string) bool {
Expand Down Expand Up @@ -38,14 +36,13 @@ func shouldWarn(endpoint string) bool {

// WarnOnUnspecifiedHost emits a warning if an endpoint has an unspecified host.
func WarnOnUnspecifiedHost(logger *zap.Logger, endpoint string) {
if !globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled() && shouldWarn(endpoint) {
if shouldWarn(endpoint) {
logger.Warn(
"Using the 0.0.0.0 address exposes this server to every network interface, which may facilitate Denial of Service attacks. Enable the feature gate to change the default and remove this warning.",
"Using the 0.0.0.0 address exposes this server to every network interface, which may facilitate Denial of Service attacks.",
zap.String(
"documentation",
"https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/security-best-practices.md#safeguards-against-denial-of-service-attacks",
),
zap.String("feature gate ID", globalgates.UseLocalHostAsDefaultHostID),
)
}
}
25 changes: 9 additions & 16 deletions exporter/otlpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
Expand All @@ -57,8 +56,6 @@ require (
go.opentelemetry.io/collector/extension v0.109.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect
go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect
go.opentelemetry.io/collector/featuregate v1.15.0 // indirect
go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.0.0-20240923154032-388e56cdb156 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect
go.opentelemetry.io/collector/pipeline v0.0.0-20240923154032-388e56cdb156 // indirect
Expand All @@ -77,8 +74,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace go.opentelemetry.io/collector => ../../

replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression
Expand All @@ -105,8 +100,6 @@ replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/extension/experimental/storage => ../../extension/experimental/storage

replace go.opentelemetry.io/collector/featuregate => ../../featuregate

replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
Expand All @@ -119,11 +112,6 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/client => ../../client

retract (
v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1
v0.69.0 // Release failed, use v0.69.1
)

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry
Expand All @@ -132,16 +120,21 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus

replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles

replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles

replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates

replace go.opentelemetry.io/collector/pipeline => ../../pipeline

replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal

replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles

replace go.opentelemetry.io/collector => ../..

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus

retract (
v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1
v0.69.0 // Release failed, use v0.69.1
)
2 changes: 0 additions & 2 deletions exporter/otlpexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions exporter/otlphttpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
Expand All @@ -56,8 +55,6 @@ require (
go.opentelemetry.io/collector/extension v0.109.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect
go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect
go.opentelemetry.io/collector/featuregate v1.15.0 // indirect
go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.0.0-20240923154032-388e56cdb156 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect
go.opentelemetry.io/collector/pipeline v0.0.0-20240923154032-388e56cdb156 // indirect
Expand Down Expand Up @@ -104,8 +101,6 @@ replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/extension/experimental/storage => ../../extension/experimental/storage

replace go.opentelemetry.io/collector/featuregate => ../../featuregate

replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
Expand All @@ -116,11 +111,6 @@ replace go.opentelemetry.io/collector/receiver => ../../receiver

replace go.opentelemetry.io/collector/consumer => ../../consumer

retract (
v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1
v0.69.0 // Release failed, use v0.69.1
)

replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry

replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
Expand All @@ -135,10 +125,13 @@ replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receive

replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles

replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates

replace go.opentelemetry.io/collector/pipeline => ../../pipeline

replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal

replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles

retract (
v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1
v0.69.0 // Release failed, use v0.69.1
)
2 changes: 0 additions & 2 deletions exporter/otlphttpexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe10446

Please sign in to comment.