Skip to content

fix(sentry-apps): reject non-latin-1 webhook headers - #123263

Open
sentry-junior[bot] wants to merge 4 commits into
masterfrom
junior/fix-sentry-5twj-webhook-header-latin1
Open

fix(sentry-apps): reject non-latin-1 webhook headers#123263
sentry-junior[bot] wants to merge 4 commits into
masterfrom
junior/fix-sentry-5twj-webhook-header-latin1

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Custom sentry-app webhook headers with non-latin-1 characters (e.g. U+3000 ideographic space in Authorization: Bearer\u3000...) cannot be sent as HTTP headers. That previously raised UnicodeEncodeError during webhook send and was recorded as a Sentry product failure.

Changes:

  • Validate webhook header names/values are latin-1 on write → API 400
  • On send, treat UnicodeEncodeError as invalid customer config (record_halt / INVALID_HEADER) instead of a failure issue
  • Same defensive handling for external-request sends that attach custom headers

Fixes SENTRY-5TWJ

This PR is made as part of daily #team-issues-oncall routine to handle the new and regressed sentry issues.

Requested by Athena Moghaddam.

--

View Junior Session [Sentry]

HTTP headers must be latin-1. Custom webhook header values with
characters like U+3000 previously crashed send as UnicodeEncodeError
and were reported as Sentry failures.

Validate headers on write (400) and halt webhook send as invalid
customer config instead of recording a product failure.

Co-Authored-By: Athena Moghaddam <athena.moghaddam@sentry.io>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 31, 2026
Comment thread src/sentry/sentry_apps/api/parsers/sentry_app.py Fixed
CodeQL flagged ValidationError(str(e)) as information exposure through
an exception. Use a fixed validation message instead.
Comment thread src/sentry/sentry_apps/external_requests/utils.py Outdated
Comment thread src/sentry/sentry_apps/external_requests/utils.py Outdated
Warden flagged that re-raising UnicodeEncodeError from external
requests still becomes outer lifecycle failures, and that passing the
raw exception to record_halt can log unmasked header secrets.

Raise SentryAppIntegratorError with a fixed halt reason instead.
backend typing failed with no-untyped-def on the external-request
invalid-header test.
@sentaur-athena
sentaur-athena marked this pull request as ready for review August 31, 2026 23:09
@sentaur-athena
sentaur-athena requested review from a team as code owners August 31, 2026 23:09
@sentaur-athena sentaur-athena added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants