Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

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

Ouverte
#2,002 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
42/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
go, postgresql

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Go
Étoiles
343
Forks
48
Merge moyen
2 j 9 h
PR mergées (30 j)
48

Préparer son environnement

  • Fournit un Dockerfile ou un fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de raystack/frontier

Toutes les issues de raystack/frontier

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.