Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Deleting an organization that has a disabled project fails and leaves it without owners

Aperta
#1,978 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

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

  1. As an organization owner, create an organization and a project in it.
  2. Disable the project with DisableProject.
  3. Call DeleteOrganization. The call answers internal error.
  4. Call GetOrganization as 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di raystack/frontier

Tutte le issue di raystack/frontier

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.