-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
endpoint: row-level security scheme #124
Comments
Given the bundle-centric nature of the architecture, we probably want to use bundles as the central organizing principle for privileges as well. A question though, while it might make sense in some scenarios for bundles to setup their own security policies, in other scenarios they might be used in entirely different ways. Security policies are rows. Are these rows tracked by the bundle that they govern? Do bundles ship with a baked-in set of policies? Sometimes. It's going to be essential to make sure that a row can only be tracked by a single bundle. Ideally this would be enforced globally (literally) but short of that, it raises the scenario that a bundle in a sense is "claiming" the rows that they will control privileges over, when they create a bundle. Let's start with some simple options.
A user-class based rule might under the hood make a privilege like: create policy x on endpoint.resource as permissive for select to "anonymous"
using (resource.id::text in (
select (row_id).pk_value
from bundle.head_commit_row
where bundle_id = '2c28d445-e3dd-45ec-a81d-fdc84ddb045c')
); For this to work, anonymous needs read access to the So, if the user chose We could create a create table bundle.bundle_security_policy (
id uuid,
role_id meta.role_id,
action text, -- named action, not `command` like in meta.policy, as per SQL grammar
relation_id meta.relation_id -- how do we specify ALL? NULL?
);
insert into bundle.bundle_security_policy (role_id, action, relation_id) values
(meta.role_id('anonymous'), 'insert', meta.relation_id('chat','message')); Then, a create policy x on chat.message as permissive for select to "anonymous"
using (select ....); No. This doesn't make sense for insert. That's a different animal. |
We're going to want to show privileges to the user that already exist (in other bundles or as just untracked privileges manually granted) and affect rows in this bundle. |
A RLS
policy
is essentially a SQL where clause that is attached to the relation. Rethink RLS in terms of bundles, maybe a permissions table that's better thanmeta.policy
andmeta.policy_role
.The text was updated successfully, but these errors were encountered: