SearchUserProjects diverges from ListProjectsByCurrentUser — missing inherited and group-expanded projects
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Ambito
- authorization, backend, databases
Direzione di ricerca
Inizia da internal/store/postgres/user_projects_repository.go, in buildBaseQuery, quindi confronta la relativa query di direct-policy con project.Service.List(Filter{Principal}) e membership.Service.ListProjectsByPrincipal. Determina innanzitutto se il progetto vuole l’opzione A, B o C; il lavoro è completato quando sono presenti la decisione registrata e la relativa implementazione, documentazione o commento, insieme al confronto di regressione specificato se viene scelta A.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Symptom
AdminService/SearchUserProjects and FrontierService/ListProjectsByCurrentUser answer effectively the same question — "which projects can this user see?" — but return different results for the same user, same org, same state.
Concrete repro
User Alice is org owner of OrgX (5 projects). She has no direct user→project policies; her visibility comes entirely from the app_organization_owner role on OrgX.
| RPC | Result |
|---|---|
ListProjectsByCurrentUser(orgID=OrgX) |
5 projects (org-inheritance expansion) |
SearchUserProjects(userID=Alice, orgID=OrgX) |
0 projects |
The same gap appears for group-mediated access: a user in a group that holds a project policy is visible to ListProjectsByCurrentUser but invisible to SearchUserProjects.
Where it lives
internal/store/postgres/user_projects_repository.go::buildBaseQuery filters the inner subquery with:
WHERE pol.principal_id = :userID
AND pol.principal_type = 'app/user' -- excludes group-mediated policies
AND pol.resource_type = 'app/project' -- excludes org-level (inherited) policies
Both filters together restrict the result to direct user→project policy rows only.
project.Service.List(Filter{Principal}), used by ListProjectsByCurrentUser, delegates to membership.Service.ListProjectsByPrincipal, which unions three paths:
- Direct project policies (gated by
schema.ProjectDirectVisibilityPerms). - Group-expanded — principal's group memberships → policies on those groups.
- Org-inherited (skipped when
NonInherited=true) — org-level policies gated byschema.OrganizationProjectInheritPerms.
The aggregate query in user_projects_repository only implements path 1.
Background
The divergence is pre-existing. It became visible after the four-PR membership listing migration (parent #1478) made the ListProjects* semantics explicit and policy-table-backed end-to-end. PR #1648 originally landed a TODO(fix) comment at the aggregate; the comment was dropped in favour of this tracked issue.
Options
- A. Align the aggregate. Rewrite
buildBaseQuerytoUNION(a) direct user→project, (b) group-expanded — principal's groups joined into project policies, (c) org-inherited — Alice's org policies whose role grants any permission inOrganizationProjectInheritPerms, expanded to all projects in those orgs. Mirrors the membership method's logic in SQL. - B. Redefine the aggregate. Document
SearchUserProjectsas "projects on which the user has a direct policy" by product decision. Update the admin UI label if needed. - C. Document and leave both as-is. Keep the divergence; add a comment explaining the semantic difference.
A is the consistent fix; B is a smaller scope decision; C is the cheapest if the divergence is acceptable.
Acceptance
- Decision recorded.
- If A: aggregate returns the same set as
project.Service.List(Filter{Principal})for a given user/org. Regression test covering an org-owner-with-no-direct-policy case. - If B: admin UI / API docs reflect the narrowed semantic.
- If C: comment near
buildBaseQuerydocumenting the divergence and linking to this issue.
- 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
-
authz bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/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
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 ·