Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Re-creating a resource by name changes its owner and drops the roles granted on it

Đang mở
#2,002 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, postgresql
Lĩnh vực
authorization, backend

Hướng nghiên cứu

Start with the conflict update in ResourceRepository.Create in internal/store/postgres/resource_repository.go, which overwrites principal_id and principal_type, then with Create in core/resource/service.go, which deletes all SpiceDB relations before re-adding the parent and owner. Reproduce the steps with CreateProjectResource, CreatePolicy and GetPolicy to confirm the owner and grants are lost. Done means re-creating an existing name keeps the original owner and its granted roles, and the relevant tests pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Creating a resource with the name of a live resource in the same project returns the existing row. The URN upsert overwrites principal_id and principal_type, and resource.Service.Create then deletes every SpiceDB relation on the resource before it adds the parent and the new owner.

So the caller becomes the owner, the first owner loses access, and every role granted on the resource stops working, while the policy rows stay. A service that re-creates a resource it already has, on a retry or a re-sync, changes the owner and drops the grants without noticing.

The principal has been overwritten since #261 and the relations deleted since #243. Organization resources (#1987) behave the same way.

Steps

  1. Member X, who can only view the project, creates resource R with CreateProjectResource.
  2. Grant member C a role on R with CreatePolicy.
  3. Member Y creates a resource with the same name and namespace in the same project.
  4. The same id comes back with Y as the principal. X can no longer update R, C's role no longer works, and GetPolicy still returns C's policy.

Code
The conflict update in ResourceRepository.Create (internal/store/postgres/resource_repository.go) writes the principal, and Create in core/resource/service.go deletes all relations on the resource.

Expected
Re-creating a resource keeps its owner and the roles granted on it.

Ngôn ngữ chính
Go
Star
344
Fork
48
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
48

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của raystack/frontier

Tất cả issue của raystack/frontier

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.