JulesJ
Convex Community9mo ago
8 replies
Jules

How to add RLS to queries/mutations within an action?

Right now, we make use of
customQuery
/
wrapDatabaseReader
,
customMutation
/
wrapDatabaseWriter
, and
Rules
from
convex-helpers
to add row-level security to our database.
We have defined
authenticatedQuery
and
authenticatedMutation
wrapper functions using this, and enforce the usage of them through ESLint rules.

Ideally, we would also like to apply the same
Rules
object to any
ctx.runQuery
/
ctx.runMutation
call within the handler of our custom
authenticatedAction
action.

Is there any way to wrap the
runQuery
and
runMutation
methods in
ActionCtx
with a
Rules
object so we can patch them in our custom action?
Was this page helpful?