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

[confighttp] Apply MaxRequestBodySize to the result of a decompressed body #10289

Conversation

jpkrohling
Copy link
Member

This change applies a restriction on the size of the decompressed payload. Before this change, this is the result of the test added in this PR:

--- FAIL: TestServerWithDecompression (0.03s)
    /home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1327: 
        	Error Trace:	/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1327
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/compression.go:163
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp.go:455
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:212
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:73
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/clientinfohandler.go:26
        	            				/usr/lib/golang/src/net/http/server.go:3137
        	            				/usr/lib/golang/src/net/http/server.go:2039
        	            				/usr/lib/golang/src/runtime/asm_amd64.s:1695
        	Error:      	An error is expected but got nil.
        	Test:       	TestServerWithDecompression
    /home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1328: 
        	Error Trace:	/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1328
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/compression.go:163
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp.go:455
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:212
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:73
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/clientinfohandler.go:26
        	            				/usr/lib/golang/src/net/http/server.go:3137
        	            				/usr/lib/golang/src/net/http/server.go:2039
        	            				/usr/lib/golang/src/runtime/asm_amd64.s:1695
        	Error:      	
        	Test:       	TestServerWithDecompression
    /home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1357: 
        	Error Trace:	/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1357
        	Error:      	Not equal: 
        	            	expected: 200
        	            	actual  : 400
        	Test:       	TestServerWithDecompression
FAIL
FAIL	go.opentelemetry.io/collector/config/confighttp	0.036s
FAIL

Signed-off-by: Juraci Paixão Kröhling [email protected]

@jpkrohling jpkrohling requested review from a team and mx-psi June 3, 2024 12:14
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.65%. Comparing base (ed767dc) to head (974aa76).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10289      +/-   ##
==========================================
+ Coverage   92.61%   92.65%   +0.03%     
==========================================
  Files         386      386              
  Lines       18229    18232       +3     
==========================================
+ Hits        16882    16892      +10     
+ Misses       1002      996       -6     
+ Partials      345      344       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mx-psi mx-psi merged commit 7dbaebb into open-telemetry:main Jun 3, 2024
49 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 3, 2024
Aneurysm9 added a commit to aws-observability/aws-otel-collector that referenced this pull request Jun 5, 2024
Upstream changes to address potential decompression-related failures in
the `confighttp` and `configgrpc` modules are backported.  See
open-telemetry/opentelemetry-collector#10289 and
open-telemetry/opentelemetry-collector#10323 for
more details.

Signed-off-by: Anthony J Mirabella <[email protected]>
Aneurysm9 added a commit to aws-observability/aws-otel-collector that referenced this pull request Jun 6, 2024
Upstream changes to address potential decompression-related failures in
the `confighttp` and `configgrpc` modules are backported.  See
open-telemetry/opentelemetry-collector#10289 and
open-telemetry/opentelemetry-collector#10323 for
more details.

Signed-off-by: Anthony J Mirabella <[email protected]>
Aneurysm9 added a commit to aws-observability/aws-otel-collector that referenced this pull request Jun 6, 2024
Upstream changes to address potential decompression-related failures in
the `confighttp` and `configgrpc` modules are backported.  See
open-telemetry/opentelemetry-collector#10289 and
open-telemetry/opentelemetry-collector#10323 for
more details.

Signed-off-by: Anthony J Mirabella <[email protected]>
steves-canva pushed a commit to Canva/opentelemetry-collector that referenced this pull request Jun 14, 2024
… body (open-telemetry#10289)

This change applies a restriction on the size of the decompressed
payload. Before this change, this is the result of the test added in
this PR:

```
--- FAIL: TestServerWithDecompression (0.03s)
    /home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1327:
        	Error Trace:	/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1327
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/compression.go:163
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp.go:455
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:212
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:73
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/clientinfohandler.go:26
        	            				/usr/lib/golang/src/net/http/server.go:3137
        	            				/usr/lib/golang/src/net/http/server.go:2039
        	            				/usr/lib/golang/src/runtime/asm_amd64.s:1695
        	Error:      	An error is expected but got nil.
        	Test:       	TestServerWithDecompression
    /home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1328:
        	Error Trace:	/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1328
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/compression.go:163
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp.go:455
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:212
        	            				/home/jpkroehling/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]/handler.go:73
        	            				/usr/lib/golang/src/net/http/server.go:2166
        	            				/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/clientinfohandler.go:26
        	            				/usr/lib/golang/src/net/http/server.go:3137
        	            				/usr/lib/golang/src/net/http/server.go:2039
        	            				/usr/lib/golang/src/runtime/asm_amd64.s:1695
        	Error:
        	Test:       	TestServerWithDecompression
    /home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1357:
        	Error Trace:	/home/jpkroehling/Projects/src/github.com/open-telemetry/opentelemetry-collector/config/confighttp/confighttp_test.go:1357
        	Error:      	Not equal:
        	            	expected: 200
        	            	actual  : 400
        	Test:       	TestServerWithDecompression
FAIL
FAIL	go.opentelemetry.io/collector/config/confighttp	0.036s
FAIL
```

Signed-off-by: Juraci Paixão Kröhling <[email protected]>

---------

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
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.

3 participants