Repeated integration DELETE runs uninstall() again and can remove a shared install from another org
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
Direzione di ricerca
Inizia in src/sentry/integrations/api/endpoints/organization_integration_details.py, in OrganizationIntegrationDetailsEndpoint.delete, e segui il controllo dello stato intorno alla chiamata a uninstall(). Restituisci 204 per le integrazioni già in stato PENDING_DELETION o DELETION_IN_PROGRESS, mantenendo l’ordine della prima DELETE. Aggiungi o esegui un test di regressione che invii DELETE due volte e confermi che la seconda richiesta non chiami di nuovo uninstall().
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
--
- Lingua principale
- Python
- Stelle
- 45.7k
- Fork
- 5k
- Merge medio
- 1g 5h
- PR unite (30g)
- 596
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di getsentry/sentry
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
getsentry/sentry#129182 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
find_referenced_groups: Fixes-keyword ID list spans newlines, linking wrong issues as fixedForse già presa @CodeAlex52 l’ha presa 33 giorni fa. ApertaProduct Area: Releases Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
getsentry/sentry#125575 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Cocoa replays hide Logs tab on supported SDK versionsForse già presa @Brian-An l’ha presa 23 giorni fa. ApertaBug Cocoa Replays
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
getsentry/sentry#124217 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
SAML2 Login Dark modeApertaProduct Area: Settings - Auth Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
getsentry/sentry#122437 · 6 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Incorrect Russian translation in django.poForse già presa @nightcityblade l’ha presa 20 giorni fa. ApertaBug Good First Issue Product Area: Settings - Integrations
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
getsentry/sentry#120651 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di getsentry/sentry
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/markitdown#2820 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
yt-project/yt#5624 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NousResearch/hermes-agent#148376 ·
I maintainer di solito rispondono entro 1 giorno