-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(api): tighten published mutation scopes #113120
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
base: dcramer/fix/api-readonly-mutation-notes
Are you sure you want to change the base?
Changes from all commits
a2b9392
eed5963
1366c6a
bccb7ae
6144c10
9b80874
a2d879b
1e12340
2f9b9e4
604f729
2a711cc
34ef4d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| from sentry.api.api_publish_status import ApiPublishStatus | ||
| from sentry.api.base import cell_silo_endpoint | ||
| from sentry.api.bases import NoProjects | ||
| from sentry.api.bases.organization import OrganizationAlertRulePermission | ||
| from sentry.api.bases.organization import ALERT_MUTATION_SCOPES, OrganizationAlertRulePermission | ||
| from sentry.api.helpers.teams import get_teams | ||
| from sentry.api.paginator import OffsetPaginator | ||
| from sentry.api.serializers import serialize | ||
|
|
@@ -331,6 +331,11 @@ def put(self, request: AuthenticatedHttpRequest, organization) -> Response: | |
|
|
||
| monitor_guids = result.pop("ids", []) | ||
| monitors = list(Monitor.objects.filter(guid__in=monitor_guids, project_id__in=project_ids)) | ||
| if not all( | ||
| request.access.has_any_project_scope(monitor.project, ALERT_MUTATION_SCOPES) | ||
| for monitor in monitors | ||
| ): | ||
| return self.respond(status=403) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| status = result.get("status") | ||
| # If enabling monitors, ensure we can assign all before moving forward | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.