Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update module go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp to v0.44.0 [security] #1145

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 22, 2023

Mend Renovate logo banner

This PR contains the following updates:

Package Type Update Change
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp require minor v0.40.0 -> v0.44.0

GitHub Vulnerability Alerts

CVE-2023-45142

Summary

This handler wrapper https://github.com/open-telemetry/opentelemetry-go-contrib/blob/5f7e6ad5a49b45df45f61a1deb29d7f1158032df/instrumentation/net/http/otelhttp/handler.go#L63-L65
out of the box adds labels

  • http.user_agent
  • http.method

that have unbound cardinality. It leads to the server's potential memory exhaustion when many malicious requests are sent to it.

Details

HTTP header User-Agent or HTTP method for requests can be easily set by an attacker to be random and long. The library internally uses httpconv.ServerRequest that records every value for HTTP method and User-Agent.

PoC

Send many requests with long randomly generated HTTP methods or/and User agents (e.g. a million) and observe how memory consumption increases during it.

Impact

In order to be affected, the program has to configure a metrics pipeline, use otelhttp.NewHandler wrapper, and does not filter any unknown HTTP methods or User agents on the level of CDN, LB, previous middleware, etc.

Others

It is similar to already reported vulnerabilities

Workaround for affected versions

As a workaround to stop being affected otelhttp.WithFilter() can be used, but it requires manual careful configuration to not log certain requests entirely.

For convenience and safe usage of this library, it should by default mark with the label unknown non-standard HTTP methods and User agents to show that such requests were made but do not increase cardinality. In case someone wants to stay with the current behavior, library API should allow to enable it.

The other possibility is to disable HTTP metrics instrumentation by passing otelhttp.WithMeterProvider option with noop.NewMeterProvider.

Solution provided by upgrading

In PR https://github.com/open-telemetry/opentelemetry-go-contrib/pull/4277, released with package version 0.44.0, the values collected for attribute http.request.method were changed to be restricted to a set of well-known values and other high cardinality attributes were removed.

References


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

…net/http/otelhttp to v0.44.0 [security]

Generated by renovateBot
@renovate renovate bot requested review from Danielius1922 and jkralik November 22, 2023 11:25
Copy link
Contributor Author

renovate bot commented Nov 22, 2023

⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: go.sum
Command failed: docker run --rm --name=renovate_a_sidecar --label=renovate_a_child --memory=3584m -v "/tmp/worker/3c5c7c/6f3019/repos/github/plgd-dev/hub":"/tmp/worker/3c5c7c/6f3019/repos/github/plgd-dev/hub" -v "/tmp/worker/3c5c7c/6f3019/cache":"/tmp/worker/3c5c7c/6f3019/cache" -e GOPATH -e GOPROXY -e GOSUMDB -e GOFLAGS -e CGO_ENABLED -e GIT_CONFIG_KEY_0 -e GIT_CONFIG_VALUE_0 -e GIT_CONFIG_KEY_1 -e GIT_CONFIG_VALUE_1 -e GIT_CONFIG_KEY_2 -e GIT_CONFIG_VALUE_2 -e GIT_CONFIG_COUNT -e CONTAINERBASE_CACHE_DIR -w "/tmp/worker/3c5c7c/6f3019/repos/github/plgd-dev/hub" ghcr.io/containerbase/sidecar:9.24.0 bash -l -c "install-tool golang 1.21.4 && go get -d -t ./... && go mod tidy && go mod tidy"
go: dropping requirement on excluded version go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0
warning: ignoring symlink /tmp/worker/3c5c7c/6f3019/repos/github/plgd-dev/hub/v2
go: downloading github.com/plgd-dev/device/v2 v2.2.3-0.20231108134455-0959ef99dc70
go: downloading github.com/plgd-dev/go-coap/v3 v3.1.6
go: downloading github.com/plgd-dev/kit/v2 v2.0.0-20211006190727-057b33161b90
go: downloading google.golang.org/grpc v1.58.2
go: downloading github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0
go: downloading google.golang.org/protobuf v1.31.0
go: downloading github.com/go-co-op/gocron v1.35.3
go: downloading github.com/google/uuid v1.4.0
go: downloading go.opentelemetry.io/otel/trace v1.14.0
go: downloading github.com/fullstorydev/grpchan v1.1.1
go: downloading go.opentelemetry.io/otel v1.14.0
go: downloading github.com/golang-jwt/jwt/v4 v4.5.0
go: downloading github.com/stretchr/testify v1.8.4
go: downloading github.com/gorilla/mux v1.8.0
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405
go: downloading google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading go.mongodb.org/mongo-driver v1.12.1
go: downloading github.com/karrick/tparse/v2 v2.8.2
go: downloading go.uber.org/atomic v1.11.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading golang.org/x/sync v0.4.0
go: downloading golang.org/x/oauth2 v0.13.0
go: downloading golang.org/x/net v0.17.0
go: downloading github.com/fxamacker/cbor/v2 v2.5.0
go: downloading github.com/ugorji/go/codec v1.2.11
go: downloading github.com/golang-jwt/jwt/v5 v5.0.0
go: downloading github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.2
go: downloading github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
go: downloading github.com/pion/dtls/v2 v2.2.8-0.20231026152330-9cc3df9c3369
go: downloading github.com/pion/logging v0.2.2
go: downloading go.uber.org/zap v1.24.0
go: downloading github.com/lestrrat-go/jwx/v2 v2.0.16
go: downloading github.com/jtacoma/uritemplates v1.0.0
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/jessevdk/go-flags v1.5.0
go: downloading github.com/fsnotify/fsnotify v1.7.0
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405
go: downloading github.com/panjf2000/ants/v2 v2.8.2
go: downloading github.com/nats-io/nats.go v1.31.0
go: downloading github.com/gorilla/websocket v1.5.0
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading github.com/json-iterator/go v1.1.12
go: downloading github.com/google/go-querystring v1.1.0
go: downloading github.com/tidwall/gjson v1.17.0
go: downloading github.com/tidwall/sjson v1.2.5
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0
go: downloading go.opentelemetry.io/otel/sdk v1.14.0
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0
go: downloading github.com/robfig/cron/v3 v3.0.1
go: downloading github.com/vincent-petithory/dataurl v1.0.0
go: downloading go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.40.0
go: downloading go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0
go: downloading github.com/felixge/httpsnoop v1.0.3
go: downloading go.opentelemetry.io/otel/metric v0.37.0
go: downloading github.com/golang/snappy v0.0.4
go: downloading golang.org/x/exp v0.0.0-20231006140011-7918f672742d
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/x448/float16 v0.8.4
go: downloading github.com/dsnet/golib/memfile v1.0.0
go: downloading github.com/pion/transport/v3 v3.0.1
go: downloading github.com/go-logr/logr v1.3.0
go: downloading go.uber.org/multierr v1.9.0
go: downloading github.com/lestrrat-go/blackmagic v1.0.2
go: downloading github.com/lestrrat-go/iter v1.0.2
go: downloading github.com/lestrrat-go/option v1.0.1
go: downloading github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
go: downloading github.com/lestrrat-go/httprc v1.0.4
go: downloading golang.org/x/sys v0.13.0
go: downloading github.com/klauspost/compress v1.16.7
go: downloading github.com/nats-io/nkeys v0.4.6
go: downloading github.com/nats-io/nuid v1.0.1
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading github.com/modern-go/reflect2 v1.0.2
go: downloading github.com/tidwall/match v1.1.1
go: downloading github.com/tidwall/pretty v1.2.1
go: downloading go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0
go: downloading go.opentelemetry.io/proto/otlp v1.0.0
go: downloading github.com/jhump/protoreflect v1.15.3
go: downloading github.com/kelseyhightower/envconfig v1.4.0
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/montanaflynn/stats v0.7.1
go: downloading golang.org/x/crypto v0.14.0
go: downloading google.golang.org/appengine v1.6.8
go: downloading github.com/go-logr/stdr v1.2.2
go: downloading github.com/segmentio/asm v1.2.0
go: downloading github.com/goccy/go-json v0.10.2
go: downloading github.com/lestrrat-go/httpcc v1.0.1
go: downloading github.com/cenkalti/backoff/v4 v4.2.1
go: downloading github.com/xdg-go/scram v1.1.2
go: downloading github.com/xdg-go/stringprep v1.0.4
go: downloading golang.org/x/text v0.13.0
go: downloading github.com/bufbuild/protocompile v0.6.0
go: downloading github.com/xdg-go/pbkdf2 v1.0.0
go: downloading go.opentelemetry.io v0.1.0
go: downloading go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
go: downloading go.opentelemetry.io/contrib v1.21.1
go: downloading go.opentelemetry.io/contrib/instrumentation/net/http v0.11.0
go: downloading go.opentelemetry.io/otel/trace v1.21.0
go: downloading go.opentelemetry.io/otel v1.21.0
go: downloading github.com/felixge/httpsnoop v1.0.4
go: downloading go.opentelemetry.io/otel/metric v1.21.0
go: downloading go.opentelemetry.io/otel/exporters/otlp v0.20.1
go: github.com/plgd-dev/hub/v2/pkg/opentelemetry/otelhttp imports
	go.opentelemetry.io/otel/metric/global: cannot find module providing package go.opentelemetry.io/otel/metric/global
go: github.com/plgd-dev/hub/v2/pkg/opentelemetry/otelhttp imports
	go.opentelemetry.io/otel/metric/instrument: cannot find module providing package go.opentelemetry.io/otel/metric/instrument
go: github.com/plgd-dev/hub/v2/pkg/opentelemetry/collector/client imports
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc imports
	go.opentelemetry.io/otel/exporters/otlp/internal: cannot find module providing package go.opentelemetry.io/otel/exporters/otlp/internal
go: github.com/plgd-dev/hub/v2/pkg/opentelemetry/collector/client imports
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc imports
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig imports
	go.opentelemetry.io/otel/exporters/otlp/internal/envconfig: cannot find module providing package go.opentelemetry.io/otel/exporters/otlp/internal/envconfig

@jkralik jkralik closed this Nov 23, 2023
Copy link
Contributor Author

renovate bot commented Nov 23, 2023

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update (v0.44.0). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

@renovate renovate bot deleted the renovate/go-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp-vulnerability branch November 23, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant