UpdatePermission renames instead of updating metadata (and drops the metadata it is given)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 70/100
Direzione di ricerca
Inizia da internal/api/v1beta1connect/permission.go e confronta UpdatePermission con CreatePermission, quindi segui Update in internal/store/postgres/permission_repository.go. Verifica come vengono gestiti i campi dei metadati e dell’identità e controlla il percorso schema.ValidateCustomPermission indicato. Il lavoro è completato quando gli aggiornamenti preservano l’identità del permesso, rendono persistenti i metadati e rifiutano le chiavi non valide senza interrompere il percorso di reconcile esistente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What
The UpdatePermission handler (internal/api/v1beta1connect/permission.go) has two problems.
-
It writes
nameandnamespace_namewith no grammar check.CreatePermissionnow runsschema.ValidateCustomPermission, but the update path runs no check at all. It parses the request key into a namespace and a name, then passes them straight to the service. A key that splits into three non-empty parts but breaks the grammar goes through unchecked:resource.Order.get(uppercase)resource.order_item.get(underscore in a part)compute.machine.owner(reserved verb)- any key whose flattened
service_resource_verbis longer than 64 characters
-
The repository
Update(internal/store/postgres/permission_repository.go) only setsname,namespace_name, andupdated_at. It never writesmetadata. So the metadata the handler builds is dropped. The only thing the endpoint actually changes is the identity, which is a rename.
Why it matters
A rename to a value SpiceDB will not accept still succeeds in Postgres. On the next server boot, MigrateSchema merges every permission row into the SpiceDB schema. The bad row fails to compile, so the server will not start until someone fixes the row by hand.
Scope and risk
Low. The reconciler never calls UpdatePermission. Its client interface has only ListPermissions, CreatePermission, and DeletePermission, and a permission is identity only (added or deleted, never updated). So only a direct API caller can hit this. It is not on the GitOps path.
Suggested fix
Two options:
- Validate the key. Resolve the key to a namespace and a name and run
schema.ValidateCustomPermissionbefore the write, the same asCreatePermission. Minimal, but it still allows a rename to a valid key. - Preferred: stop renaming. A permission's identity is fixed once it is created, so the update path should change only metadata. Make the handler and the repository
Updatewrite onlymetadatabyidand never touchnameornamespace_name. This makes the endpoint do what it claims, drops the dependence on the deprecatednameandnamespacefields, and fixes the dropped-metadata bug at the same time.
Context
Found during review of the reconcile permission PRs (#1889 added the shared schema.ValidateCustomPermission; #1892 switched the Permission kind to the key form). It was agreed there to track this as a follow-up rather than widen those PRs.
- Lingua principale
- Go
- Stelle
- 344
- Fork
- 47
- Merge medio
- 4g 4h
- PR unite (30g)
- 26
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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
-
enhancement go
Difficoltà 4/5 3-5 giorni Idoneità per principianti 62/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
-
Add OpenTelemetry tracing Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 75/100
Tutte le issue di raystack/frontier
Issue simili
-
nix: vendorHash is outdated Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Bob Shell support Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
santhosh-tekuri/jsonschema#276 ·