Skip to content

rbac: verify compiled SQL queries honor implicit ACL handling from RBACObject() #25982

Open

Description

@Emyrk

Follow-up from PR #25929 review thread on the "Intentionally omitted" block in OrgWorkspaceAccessMemberPerms:

Mention this ACL is implicit in the RBACObject() method.

We need an issue to track this for any compiled SQL queries.
Review #14200 maybe when making that issue.

Context

For resources like Group and Template, member-scope access is not granted by a Member-level perm in any role. Instead, it falls out of the ACL applied implicitly by the resource's RBACObject() method, e.g. Group.RBACObject() populates GroupACL, and the in-memory authorizer's ACL path then matches "this user is in a group with read on this object".

This works for the in-memory authorization path (Rego policy evaluation against a hydrated RBACObject). It is unclear whether the regosql-compiled SQL queries (the AuthorizedQuery/prepared path used to filter list queries directly in Postgres) apply the same ACL logic for every resource type. If a compiled query path skips the implicit-ACL handling, a list endpoint could either over- or under-filter relative to the in-memory authorizer.

The canonical example to study is #14200 (group members reading their own groups + reduced member counts), which added the ACL-driven "groups I'm in" read path. Verify each compiled-SQL list query for Group, Template, and any other ACL-backed resource exercises the same ACL rule that RBACObject() injects.

Suggested scope

  • Audit coderd/rbac/regosql/... and the compiled query paths for Group, Template, and any other resource whose member access depends on ACL rather than WithOwner(...).
  • For each, confirm the compiled SQL applies the same acl_user_list / acl_group_list semantics as the Rego policy.
  • Add regression tests where coverage is missing.

Filed by Coder Agents on behalf of @Emyrk.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions