Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

SearchUserProjects diverges from ListProjectsByCurrentUser — missing inherited and group-expanded projects

Aperta
#1,650 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
Stack tecnologico
go, sql

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:

  1. Direct project policies (gated by schema.ProjectDirectVisibilityPerms).
  2. Group-expanded — principal's group memberships → policies on those groups.
  3. Org-inherited (skipped when NonInherited=true) — org-level policies gated by schema.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 buildBaseQuery to UNION (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 in OrganizationProjectInheritPerms, expanded to all projects in those orgs. Mirrors the membership method's logic in SQL.
  • B. Redefine the aggregate. Document SearchUserProjects as "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 buildBaseQuery documenting 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di raystack/frontier

Tutte le issue di raystack/frontier

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.