Skip to main content

RLS and category queries

Category lookups used in product naming must respect organization-level row-level security (RLS). A category ID submitted by a caller is not, by itself, proof that its name is visible or belongs in the caller's catalog.

The category repository binds app.organization_id in the same transaction as its queries. Partner category operations can target the partner itself or one of its vendors; vendor callers remain scoped to their own organization. Name regeneration resolves a category through an RLS-aware lookup when the category name is not already available.

This keeps raw SQL and Prisma queries within the same organization policy boundary. See Categories API for scope resolution and partner/vendor ownership for the relationship model.