Repeated integration DELETE runs uninstall() again and can remove a shared install from another org
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
- #129230 de @sentry-junior — fusionado
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza en src/sentry/integrations/api/endpoints/organization_integration_details.py, en OrganizationIntegrationDetailsEndpoint.delete, y sigue la comprobación del estado alrededor de la llamada a uninstall(). Devuelve 204 para las integraciones que ya estén en PENDING_DELETION o DELETION_IN_PROGRESS, manteniendo el orden del primer DELETE. Añade o ejecuta una prueba de regresión que envíe DELETE dos veces y confirme que la segunda solicitud no vuelve a llamar a uninstall().
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
--
- Lenguaje dominante
- Python
- Estrellas
- 45.7k
- Forks
- 5k
- Merge medio
- 1 d 34 min
- PR fusionados (30 d)
- 611
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/sentry
-
Tag keys like os.name are auto-linked as domains in issue alert emailsPosiblemente ocupada @ashrafulX la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
getsentry/sentry#129182 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
find_referenced_groups: Fixes-keyword ID list spans newlines, linking wrong issues as fixedPosiblemente ocupada @CodeAlex52 la tomó hace 36 días. AbiertoProduct Area: Releases Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
getsentry/sentry#125575 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Cocoa replays hide Logs tab on supported SDK versionsPosiblemente ocupada @Brian-An la tomó hace 26 días. AbiertoBug Cocoa Replays
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
getsentry/sentry#124217 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
SAML2 Login Dark modeAbiertoProduct Area: Settings - Auth Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
getsentry/sentry#122437 · 6 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Incorrect Russian translation in django.poPosiblemente ocupada @nightcityblade la tomó hace 22 días. AbiertoBug Good First Issue Product Area: Settings - Integrations
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
getsentry/sentry#120651 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/sentry
Issues similares
-
docs: Release playbookAbiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
awslabs/social-messaging-agent-runtime-toolkit#140 ·
Los mantenedores suelen responder en 1 día
-
subtask
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
fga-eps-mds/2026.2-MeasureSoftGram-DOC#187 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
txn2/mcp-data-platform#2493 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
YO-WHATS-UP2/minigit#78 ·
Los mantenedores suelen responder en 3 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
liberation-data/drivine-python#432 ·
Los mantenedores suelen responder en 1 día