Repeated integration DELETE runs uninstall() again and can remove a shared install from another org
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu tại src/sentry/integrations/api/endpoints/organization_integration_details.py, trong OrganizationIntegrationDetailsEndpoint.delete, và theo dõi phần kiểm tra trạng thái xung quanh lời gọi uninstall(). Trả về 204 cho các integration đã ở trạng thái PENDING_DELETION hoặc DELETION_IN_PROGRESS, đồng thời giữ nguyên thứ tự của DELETE đầu tiên. Thêm hoặc chạy một bài kiểm thử hồi quy gửi DELETE hai lần và xác nhận rằng yêu cầu thứ hai không gọi lại uninstall().
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
OrganizationIntegrationDetailsEndpoint.delete (src/sentry/integrations/api/endpoints/organization_integration_details.py) calls the provider's uninstall() hook on every request, even when the OrganizationIntegration is already PENDING_DELETION:
- The org integration lookup doesn't filter on status, so a second DELETE finds the pending row.
integration.get_installation(...).uninstall()runs unconditionally.- Only after that, the
status__in=[ACTIVE, DISABLED]guard prevents a secondScheduledDeletionand audit entry. - The endpoint returns 204 either way.
The guard covers the database side effects, but not the external one.
Impact
Discord's and Cursor Origin's uninstall() only remove the external install when they think the current org is the last one using it, and they skip rows that are PENDING_DELETION / DELETION_IN_PROGRESS when counting.
With orgs A and B sharing one Discord server:
- First DELETE from A: A's row is still active, the hook counts A and B, sees 2 installs and does nothing. A's row becomes pending.
- Second DELETE from A (client retry, double click, replayed request): the hook now counts only B, sees 1 install, and calls
leave_guild. The Sentry bot leaves the server that org B still uses.
Cursor Origin has the same pattern and would call delete_installation on an installation another org still uses to mint tokens.
Reproduced locally with a regression test on master: the second DELETE triggers one leave_guild call.
Fix
Return 204 before calling uninstall() when the org integration is already PENDING_DELETION or DELETION_IN_PROGRESS. The first DELETE keeps its current ordering (uninstall runs while the row is still active, so the hooks count it).
Notes
- Concurrent first DELETEs can still both pass the check before either commits the status change. That window is narrow; closing it would mean holding a row lock across the external uninstall call, which this fix doesn't do.
- Found during the endpoint idempotency audit in #128927.
via @BYK.
--
- Ngôn ngữ chính
- Python
- Star
- 45.7k
- Fork
- 5k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 655
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getsentry/sentry#129182 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
find_referenced_groups: Fixes-keyword ID list spans newlines, linking wrong issues as fixedCó thể đã có người làm @CodeAlex52 đã nhận 31 ngày trước. Đang mởProduct Area: Releases Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
getsentry/sentry#125575 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Cocoa replays hide Logs tab on supported SDK versionsCó thể đã có người làm @Brian-An đã nhận 21 ngày trước. Đang mởBug Cocoa Replays
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
getsentry/sentry#124217 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SAML2 Login Dark modeĐang mởProduct Area: Settings - Auth Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
getsentry/sentry#122437 · 6 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Incorrect Russian translation in django.poCó thể đã có người làm @nightcityblade đã nhận 17 ngày trước. Đang mởBug Good First Issue Product Area: Settings - Integrations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
getsentry/sentry#120651 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của getsentry/sentry
Issue tương tự
-
Keybind quest outdatedĐang mởStatus: Triage Type: Quest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
GTNewHorizons/GT-New-Horizons-Modpack#27490 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
retentioneering/retentioneering-tools#231 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
geolens-io/geolens#3568 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
mprov-ng/mprov_control_center#450 ·
Maintainer thường phản hồi trong vòng 1 ngày