Skip to content

Commit a959af6

Browse files
chore(hc): Handles sentry app permission check where org is not found (#69175)
1 parent 3b2015a commit a959af6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/sentry/api/bases/sentryapps.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import logging
34
from functools import wraps
45
from typing import Any
56

@@ -33,6 +34,8 @@
3334

3435
COMPONENT_TYPES = ["stacktrace-link", "issue-link"]
3536

37+
logger = logging.getLogger(__name__)
38+
3639

3740
def catch_raised_errors(func):
3841
@wraps(func)
@@ -487,6 +490,16 @@ def has_object_permission(self, request: Request, view, sentry_app: SentryApp |
487490
owner_app = organization_service.get_organization_by_id(
488491
id=sentry_app.owner_id, user_id=request.user.id
489492
)
493+
if owner_app is None:
494+
logger.error(
495+
"sentry_app_stats.permission_org_not_found",
496+
extra={
497+
"sentry_app_id": sentry_app.id,
498+
"owner_org_id": sentry_app.owner_id,
499+
"user_id": request.user.id,
500+
},
501+
)
502+
return False
490503
self.determine_access(request, owner_app)
491504

492505
if is_active_superuser(request):

0 commit comments

Comments
 (0)