fix(sentryapps): Cache Sentry App installation lookups to prevent blocking RPCs #113493
1 issue
sentry-backend-bugs: Found 1 issue (1 medium)
Medium
SentryApp.DoesNotExist not handled in outboxes_for_delete when accessing proxy_user_id - `src/sentry/sentry_apps/models/sentry_app_installation.py:170`
The new code at line 170 accesses self.sentry_app.proxy_user_id without handling SentryApp.DoesNotExist. Since SentryApp uses ParanoidModel (soft-delete), the parent SentryApp may be soft-deleted before the installation's outboxes_for_delete is called. The same file already demonstrates this pattern at lines 146-149 where api_application_id catches SentryApp.DoesNotExist. This will cause deletion to fail with an unhandled exception when the SentryApp has been deleted first.
Duration: 1m 19s · Tokens: 340.1k in / 5.9k out · Cost: $0.68 (+extraction: $0.01)
Annotations
Check warning on line 170 in src/sentry/sentry_apps/models/sentry_app_installation.py
sentry-warden / warden: sentry-backend-bugs
SentryApp.DoesNotExist not handled in outboxes_for_delete when accessing proxy_user_id
The new code at line 170 accesses `self.sentry_app.proxy_user_id` without handling `SentryApp.DoesNotExist`. Since SentryApp uses ParanoidModel (soft-delete), the parent SentryApp may be soft-deleted before the installation's outboxes_for_delete is called. The same file already demonstrates this pattern at lines 146-149 where `api_application_id` catches `SentryApp.DoesNotExist`. This will cause deletion to fail with an unhandled exception when the SentryApp has been deleted first.