-
Notifications
You must be signed in to change notification settings - Fork 619
[AutoPR- Security] Patch moby-engine for CVE-2026-39882 [MEDIUM] #16681
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
Merged
kgodara912
merged 3 commits into
microsoft:3.0-dev
from
azurelinux-security:azure-autosec/moby-engine/3.0/1095458
Apr 20, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| From 7f1cb3338a73160ce9e13abc7c2ba1324e5e6dd6 Mon Sep 17 00:00:00 2001 | ||
| From: AllSpark <allspark@microsoft.com> | ||
| Date: Wed, 15 Apr 2026 07:25:48 +0000 | ||
| Subject: [PATCH] vendor(otel): limit response body size for OTLP HTTP exporter | ||
| (backport of #8108) | ||
|
|
||
| Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> | ||
| Upstream-reference: AI Backport of https://github.com/open-telemetry/opentelemetry-go/commit/5e363de517dba6db62736b2f5cdef0e0929b4cd0.patch | ||
| --- | ||
| .../otlp/otlptrace/otlptracehttp/client.go | 21 +++++++++++++++++-- | ||
| 1 file changed, 19 insertions(+), 2 deletions(-) | ||
|
|
||
| diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go | ||
| index 3a3cfec..33d0923 100644 | ||
| --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go | ||
| +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go | ||
| @@ -18,6 +18,7 @@ import ( | ||
| "bytes" | ||
| "compress/gzip" | ||
| "context" | ||
| + "errors" | ||
| "fmt" | ||
| "io" | ||
| "net" | ||
| @@ -40,6 +41,13 @@ import ( | ||
|
|
||
| const contentTypeProto = "application/x-protobuf" | ||
|
|
||
| +// maxResponseBodySize is the maximum number of bytes to read from a response | ||
| +// body. It is set to 4 MiB per the OTLP specification recommendation to | ||
| +// mitigate excessive memory usage caused by a misconfigured or malicious | ||
| +// server. If exceeded, the response is treated as a not-retryable error. | ||
| +// This is a variable to allow tests to override it. | ||
| +var maxResponseBodySize int64 = 4 * 1024 * 1024 | ||
| + | ||
| var gzPool = sync.Pool{ | ||
| New: func() interface{} { | ||
| w := gzip.NewWriter(io.Discard) | ||
| @@ -169,7 +177,11 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc | ||
| // Success, do not retry. | ||
| // Read the partial success message, if any. | ||
| var respData bytes.Buffer | ||
| - if _, err := io.Copy(&respData, resp.Body); err != nil { | ||
| + if _, err := io.Copy(&respData, http.MaxBytesReader(nil, resp.Body, maxResponseBodySize)); err != nil { | ||
| + var maxBytesErr *http.MaxBytesError | ||
| + if errors.As(err, &maxBytesErr) { | ||
| + return fmt.Errorf("response body too large: exceeded %d bytes", maxBytesErr.Limit) | ||
| + } | ||
| return err | ||
| } | ||
|
|
||
| @@ -192,7 +204,12 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc | ||
|
|
||
| case sc == http.StatusTooManyRequests, sc == http.StatusServiceUnavailable: | ||
| // Retry-able failures. Drain the body to reuse the connection. | ||
| - if _, err := io.Copy(io.Discard, resp.Body); err != nil { | ||
| + var respData bytes.Buffer | ||
| + if _, err := io.Copy(&respData, http.MaxBytesReader(nil, resp.Body, maxResponseBodySize)); err != nil { | ||
| + var maxBytesErr *http.MaxBytesError | ||
| + if errors.As(err, &maxBytesErr) { | ||
| + return fmt.Errorf("response body too large: exceeded %d bytes", maxBytesErr.Limit) | ||
| + } | ||
| otel.Handle(err) | ||
| } | ||
| return newResponseError(resp.Header) | ||
| -- | ||
| 2.43.0 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be a partial fix. The upstream has two places where
io.Copyis replaced with the updated signature, success and Error cases. Downstream also has the same but in switch case instead of handling it with if else. Following is the snippet,The
io.Copyin error case also, we should put the same bound checking even though we are discarding it but read may still consume same high memory.