Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#1,978 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Go
星标
344
派生
48
平均合并
1 天 22 小时
30 天内合并 PR
38

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

raystack/frontier 的其他 Issue

查看 raystack/frontier 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。