fix(sentry-apps): gate error webhook subscriptions correctly#120611
Open
cvxluo wants to merge 1 commit into
Open
fix(sentry-apps): gate error webhook subscriptions correctly#120611cvxluo wants to merge 1 commit into
cvxluo wants to merge 1 commit into
Conversation
…e event-hooks entitlement Co-authored-by: Claude <noreply@anthropic.com>
Comment on lines
+139
to
+146
| def has_error_events(events: Collection[str] | None) -> bool: | ||
| """Whether any entry subscribes to error webhooks, as the whole resource or a single event.""" | ||
| return any( | ||
| event == SentryAppResourceType.ERROR or resource_of(event) is SentryAppResourceType.ERROR | ||
| for event in events or () | ||
| ) | ||
|
|
||
|
|
Contributor
There was a problem hiding this comment.
has_error_events iterates over raw request events without type guard
has_error_events is called on unvalidated request.data['events'] before the serializer runs. A non-iterable value such as an integer raises TypeError instead of a validation error.
Evidence
has_error_eventsis called fromsentry_apps.py:post()andsentry_app_details.py:put()onrequest.data.get('events')beforeSentryAppParserserializes the payload.- The generator
for event in events or ()assumeseventsis iterable; a JSON body like{"events": 42}yields42, which is not iterable and raisesTypeError. - The parser's
EventListFieldwould also reject an int, buthas_error_eventsruns first and turns a validation error into an unhandled 500.
Identified by Warden · sentry-backend-bugs · 4GZ-TU4
cvxluo
marked this pull request as ready for review
July 25, 2026 00:10
scttcper
approved these changes
Jul 25, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I slightly misconfigured the flag checks when GAing granular webhook subscriptions, so that in theory someone could pass
error.createddirectly to the API and bypass the appropriate flag check for error events. Clean up that path.