Skip to content

fix(cli): Reject custom header values that fetch cannot send - #1604

Merged
BYK merged 1 commit into
mainfrom
fix/cli-custom-header-values
Oct 23, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/cli-custom-header-values

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

A custom header value with emoji, other non-Latin-1 characters, CR, LF, or NUL made undici's Headers.set() throw an opaque TypeError: Cannot convert argument to a ByteString at request time (CLI-31G).

Values from SENTRY_CUSTOM_HEADERS and SentryOptions.headers are now validated up front and rejected with a ConfigError that names the header but never echoes its value, since these headers often carry proxy credentials.

The e2e redaction test used a CR in a header to reach the unexpected-error path. It now asserts the config error instead; redaction of unexpected errors stays covered by the unit tests.

Ported from getsentry/cli#1660, which is being closed with the repo archive.

via BYK.

--

View Junior Session in Sentry

A custom header value with emoji, other non-Latin-1 characters, CR, LF,
or NUL made undici's Headers.set() throw an opaque TypeError at request
time (CLI-31G). Validate values from SENTRY_CUSTOM_HEADERS and
SentryOptions.headers up front and throw a ConfigError that names the
header without echoing its value.

Ported from getsentry/cli#1660.

Co-Authored-By: BYK <burak.kaya@sentry.io>
@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 22, 2026 6:30pm UTC

Request Review

@BYK
BYK merged commit b7e0366 into main Oct 23, 2026
32 of 34 checks passed
@BYK
BYK deleted the fix/cli-custom-header-values branch October 23, 2026 11:16
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…ntry#1604)

## Root Cause

The `seedTrustedRegionOriginsIfNeeded` function in
`src/lib/db/regions.ts` catches all database errors silently when
seeding trusted region origins from the SQLite cache. While the fallback
behavior (first-run callers populate via `setOrgRegion(s)` or
`registerTrustedRegionUrls`) is correct, the complete absence of logging
masks real issues like corrupted WAL files, locked databases, or schema
mismatches.

## Reproduction Path

Any CLI command that triggers `isTrustedRegionOrigin()` (which
lazy-seeds via this function) when the database is in an unexpected
state — e.g., a corrupted WAL file, a database locked by another
process, or a schema mismatch after a partial migration.

## Fix

Add a `logger` import and a module-level `log =
logger.withTag('db.regions')` tag. Replace the empty `catch {}` block
with `catch (error) { log.debug(...) }` and remove the `biome-ignore
lint/plugin: grandfathered silent catch` suppression comment.

<div><a
href="https://cursor.com/agents/bc-75237683-a26e-4eb9-a37a-83adb22a47e0?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/automations/95624600-485e-4461-829e-6b76f086c473"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/view-automation-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/view-automation-light.png"><img
alt="View Automation" width="141" height="28"
src="https://cursor.com/assets/images/view-automation-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
joshuawayzwright pushed a commit to joshuawayzwright/sentry-mcp that referenced this pull request Nov 16, 2026
…ntry#1604)

## Root Cause

The `seedTrustedRegionOriginsIfNeeded` function in
`src/lib/db/regions.ts` catches all database errors silently when
seeding trusted region origins from the SQLite cache. While the fallback
behavior (first-run callers populate via `setOrgRegion(s)` or
`registerTrustedRegionUrls`) is correct, the complete absence of logging
masks real issues like corrupted WAL files, locked databases, or schema
mismatches.

## Reproduction Path

Any CLI command that triggers `isTrustedRegionOrigin()` (which
lazy-seeds via this function) when the database is in an unexpected
state — e.g., a corrupted WAL file, a database locked by another
process, or a schema mismatch after a partial migration.

## Fix

Add a `logger` import and a module-level `log =
logger.withTag('db.regions')` tag. Replace the empty `catch {}` block
with `catch (error) { log.debug(...) }` and remove the `biome-ignore
lint/plugin: grandfathered silent catch` suppression comment.

<div><a
href="https://cursor.com/agents/bc-75237683-a26e-4eb9-a37a-83adb22a47e0?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/automations/95624600-485e-4461-829e-6b76f086c473"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/view-automation-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/view-automation-light.png"><img
alt="View Automation" width="141" height="28"
src="https://cursor.com/assets/images/view-automation-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>

This branch was previously deployed

1 inactive deployment
Preview — b443da4a Deployed Oct 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant