Repeated integration DELETE runs uninstall() again and can remove a shared install from another org
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
調査の方向性
src/sentry/integrations/api/endpoints/organization_integration_details.py の OrganizationIntegrationDetailsEndpoint.delete から始めて、uninstall() 呼び出し前後のステータスチェックを追ってください。すでに PENDING_DELETION または DELETION_IN_PROGRESS のインテグレーションには204を返し、最初の DELETE の順序を維持してください。DELETE を2回送信し、2回目のリクエストで uninstall() が再度呼び出されないことを確認する回帰テストを追加または実行してください。
索引モデルが issue の本文から書いたものです。
説明
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.
--
- 主要言語
- Python
- スター
- 45.7k
- フォーク
- 5k
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 655
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
getsentry/sentry#129182 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
find_referenced_groups: Fixes-keyword ID list spans newlines, linking wrong issues as fixed対応中かも @CodeAlex52 が 31 日前に担当しました。 オープンProduct Area: Releases Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
getsentry/sentry#125575 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Cocoa replays hide Logs tab on supported SDK versions対応中かも @Brian-An が 21 日前に担当しました。 オープンBug Cocoa Replays
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
getsentry/sentry#124217 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Product Area: Settings - Auth Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
getsentry/sentry#122437 · コメント 6 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Incorrect Russian translation in django.po対応中かも @nightcityblade が 18 日前に担当しました。 オープンBug Good First Issue Product Area: Settings - Integrations
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
getsentry/sentry#120651 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/sentry の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
[Bug]: Responses API 500s on assistant message with empty content list対応中かも @shadowmodder が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
vllm-project/vllm#64940 ·
メンテナーはふだん 1 日以内に返信
-
limits
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
agent-ready area: docs documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Soneso/stellar-agent-wallet#524 ·
メンテナーはふだん 1 日以内に返信
-
Status: Triage Type: Quest
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
GTNewHorizons/GT-New-Horizons-Modpack#27490 ·
メンテナーはふだん 1 日以内に返信