Deleting an organization that has a disabled project fails and leaves it without owners
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- authorization, backend
Direzione di ricerca
Start in core/deleter/service.go at DeleteOrganization and CheckOrganizationDelete, then read the notDisabledProjectExp filter in internal/store/postgres/project_repository.go to see why disabled projects are missed by projectService.List. Groups hit the same path through groupService.List. Done means deleting an organization that has a disabled project or group either removes it fully or refuses before any policy is deleted, so owners keep access. Check that behaviour with a test in the deleter package.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
DeleteOrganization deletes the organization's projects one by one before it removes the organization row. It lists them with projectService.List(project.Filter{OrgID: id}) (core/deleter/service.go, DeleteOrganization), and that list leaves out disabled projects unless a state is asked for (internal/store/postgres/project_repository.go, the notDisabledProjectExp filter). A disabled project is therefore never deleted. The organization row delete then fails on the foreign key from projects.org_id:
foreign key violation [Key (id)=(<org id>) is still referenced from table "projects"]
By that point the deleter has already removed every policy on the organization, including the owners'. The steps are not in one transaction, so nothing is rolled back. The organization is left with no owner. The person who ran the delete gets permission denied on every call for that organization afterwards, including GetOrganization, EnableProject and a second DeleteOrganization. Only a platform superuser can recover it.
Groups have the same shape: groupService.List skips disabled groups and groups.org_id has the same foreign key.
Steps to reproduce
- As an organization owner, create an organization and a project in it.
- Disable the project with
DisableProject. - Call
DeleteOrganization. The call answers internal error. - Call
GetOrganizationas the same owner. The call answers permission denied.
Why it matters
The comment on DeleteOrganization says the org policies go near the end so that a failure at any step leaves the organization owned and the delete can simply be run again. The row delete is the one step after the policies, and this is a plain way to make it fail.
Proposed fix
List projects and groups including disabled ones in the delete cascade, so they are deleted with the organization. As a guard for other causes, CheckOrganizationDelete and the delete itself could refuse up front when a disabled project or group exists, before any policy is removed.
- Lingua principale
- Go
- Stelle
- 344
- Fork
- 48
- Merge medio
- 1g 22h
- PR unite (30g)
- 38
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna 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 raystack/frontier
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di raystack/frontier
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
bug go
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
genkit-ai/genkit#6761 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
github/github-mcp-server#3475 ·
I maintainer di solito rispondono entro 4 giorni