Skip to content

fix(telemetry): bound processing of prefixed metadata headers - #631

Merged
sfc-gh-ikryvanos merged 3 commits into
mainfrom
fix/telemetry-bound-metadata-headers
Aug 27, 2026
Merged

fix(telemetry): bound processing of prefixed metadata headers#631
sfc-gh-ikryvanos merged 3 commits into
mainfrom
fix/telemetry-bound-metadata-headers

Conversation

@sfc-gh-ikryvanos

Copy link
Copy Markdown
Collaborator

logMetadata attached each prefixed metadata value with its own WithValues call (O(N^2) slice copies) and both it and passAlongMetadata processed an unbounded number of caller-supplied headers before authorization. A flood of headers could therefore exhaust CPU/memory and spam the audit log.

Collect prefixed pairs once, cap the pair count and per-value length, and attach/forward them in a single call. Adds a unit test for the bounds.

logMetadata attached each prefixed metadata value with its own WithValues
call (O(N^2) slice copies) and both it and passAlongMetadata processed an
unbounded number of caller-supplied headers before authorization. A flood
of headers could therefore exhaust CPU/memory and spam the audit log.

Collect prefixed pairs once, cap the pair count and per-value length, and
attach/forward them in a single call. Adds a unit test for the bounds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread telemetry/telemetry.go
@sfc-gh-ikryvanos
sfc-gh-ikryvanos enabled auto-merge (squash) August 27, 2026 09:41
@sfc-gh-ikryvanos
sfc-gh-ikryvanos merged commit 21acb6c into main Aug 27, 2026
7 checks passed
@sfc-gh-ikryvanos
sfc-gh-ikryvanos deleted the fix/telemetry-bound-metadata-headers branch August 27, 2026 13:22
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.

2 participants