Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(hc): Handles sentry app permission check where org is not found #69175

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/sentry/api/bases/sentryapps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import logging
from functools import wraps
from typing import Any

Expand Down Expand Up @@ -33,6 +34,8 @@

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

logger = logging.getLogger(__name__)


def catch_raised_errors(func):
@wraps(func)
Expand Down Expand Up @@ -487,6 +490,16 @@ def has_object_permission(self, request: Request, view, sentry_app: SentryApp |
owner_app = organization_service.get_organization_by_id(
id=sentry_app.owner_id, user_id=request.user.id
)
if owner_app is None:
logger.error(
"sentry_app_stats.permission_org_not_found",
extra={
"sentry_app_id": sentry_app.id,
"owner_org_id": sentry_app.owner_id,
"user_id": request.user.id,
},
)
return False
self.determine_access(request, owner_app)

if is_active_superuser(request):
Expand Down
Loading