Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Fixed

- Limit the request body size at 1MB in `go.opentelemetry.io/contrib/zpages`. (#8656)

<!-- Released section -->
<!-- Don't change this section unless doing release -->

Expand Down
4 changes: 4 additions & 0 deletions zpages/tracez.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const (
spanLatencyBucketQueryField = "zlatencybucket"
// maxTraceMessageLength is the maximum length of a message in tracez output.
maxTraceMessageLength = 1024

maxRequestBodySize = 1 << 20 // 1MB
)

type summaryTableData struct {
Expand Down Expand Up @@ -79,6 +81,8 @@ func NewTracezHandler(sp *SpanProcessor) http.Handler {
// ServeHTTP implements the http.Handler and is capable of serving "tracez" HTTP requests.
func (th *tracezHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")

r.Body = http.MaxBytesReader(w, r.Body, maxRequestBodySize)
if err := r.ParseForm(); err != nil {
w.WriteHeader(http.StatusBadRequest)
return
Expand Down
Loading