Skip to content
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

[SIP-29] Add support for row-level security #8699

Merged
merged 49 commits into from
Feb 22, 2020
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ab6ae45
Support and apply filters.
altef Nov 27, 2019
024912e
Added the UI for row level security, and moved it all under SQLA in o…
altef Nov 29, 2019
4d6789f
Added a row level security filter documentation entry.
altef Nov 30, 2019
4152dc2
Accidentally added two new lines to this file.
altef Nov 30, 2019
13f1381
Blacked and iSorted, hopefully. Also, sometimes g.user may not be set.
altef Nov 30, 2019
1100a60
Another isort, and handling g not having a user attribute another way.
altef Nov 30, 2019
76a314a
Let's try this again #CI tests.
altef Nov 30, 2019
86234fa
Adjusted import order for isort; I was sure I'd already done this..
altef Nov 30, 2019
81c2bdb
Row level filters should be wrapped in parentheses in case one contai…
altef Nov 30, 2019
ff80add
Oops, did not think that would change Black's formatting.
altef Nov 30, 2019
aafce2f
Changes as per @mistercrunch.
altef Dec 4, 2019
fd0eaf6
RLS filters are now many-to-many with Roles.
altef Dec 4, 2019
8b6ce72
Updated documentation to reflect RLS filters supporting multiple rows.
altef Dec 4, 2019
5f69386
Let's see what happens when I set it to the previous revision ID
altef Dec 4, 2019
032efcb
Merge branch 'master' into row-level-security
altef Dec 4, 2019
2c252d9
Updated from upstream.
altef Dec 4, 2019
7223da6
There was a pylint error.
altef Dec 4, 2019
84a5009
Added RLS ids to the cache keys; modified documentation; added templa…
altef Dec 9, 2019
7e0e3c8
Merge branch 'master' into row-level-security
altef Dec 9, 2019
253e992
A new migration was merged in.
altef Dec 9, 2019
1b3b8f6
Removed RLS cache key from query_object.
altef Dec 9, 2019
c0ac8e9
RLS added to the cache_key from query_context.
altef Dec 10, 2019
bdfaff6
Merge branch 'master' into row-level-security
altef Dec 11, 2019
041038e
Changes as per @etr2460.
altef Dec 17, 2019
8f0d0d1
Updating entry for RLS pull request.
altef Dec 17, 2019
b402fc2
Merge branch 'master' into row-level-security
altef Dec 17, 2019
e403e9b
Another migration to skip.
altef Dec 17, 2019
9c71f05
Catchup.
altef Jan 10, 2020
78ebc1c
Merge branch 'row-level-security' of https://github.com/altef/incubat…
altef Jan 10, 2020
5a0257c
Changes as per @serenajiang.
altef Jan 10, 2020
9d4bcad
Blacked.
altef Jan 10, 2020
790f395
Blacked and added some attributes to check for.
altef Jan 10, 2020
8adfc89
Changed to a manual query as per @mistercrunch.
altef Jan 14, 2020
2b0ccfc
Blacked.
altef Jan 14, 2020
c68d6e6
Merge branch 'master' into row-level-security
altef Jan 14, 2020
b82acf6
Another migration in the meantime.
altef Jan 14, 2020
d94e6aa
Black wanted some whitespace changes.
altef Jan 14, 2020
f76e953
AttributeError: 'AnonymousUserMixin' object has no attribute 'id'.
altef Jan 14, 2020
3d0822d
Oops, did hasattr backwards.
altef Jan 14, 2020
db9f20a
Merge branch 'master' into row-level-security
altef Jan 23, 2020
524c109
Merge branch 'master' into row-level-security
altef Jan 24, 2020
a2e6b67
Changes as per @mistercrunch.
altef Jan 24, 2020
f581cf7
Doesn't look like text us required here anymore.
altef Jan 24, 2020
085a501
Changes as per @dpgaspar
altef Feb 13, 2020
a625111
Two RLS tests.
altef Feb 13, 2020
a131a72
Row level security is now disabled by default via the feature flag EN…
altef Feb 21, 2020
2ea460b
Merge branch 'master' into row-level-security
altef Feb 21, 2020
1451c05
New head to revise.
altef Feb 21, 2020
5eeb296
Changed the comment.
altef Feb 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added a row level security filter documentation entry.
  • Loading branch information
altef committed Nov 30, 2019
commit 4d6789f00ff0a2b1c2d511d3ea63bd2fa73310b8
25 changes: 25 additions & 0 deletions docs/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,28 @@ a set of data sources that power dashboards only made available to executives.
When looking at its dashboard list, this user will only see the
list of dashboards it has access to, based on the roles and
permissions that were attributed.


Restricting access to a subset of a particular table
""""""""""""""""""""""""""""""""""""""""""""""""""""

Using ``Row level security filters`` (under the ``Security`` menu) you can create
filters that are assigned to a particular table, as well as a particular role.
Say people in your finance department should only have access to rows where
``department = "finance"``. You could create a ``Row level security filter``
with that clause, and assign it to your ``Finance`` role, as well as the
applicable table.

The ``clause`` field can contain arbitrary text which is then added to the generated
SQL statement's ``WHERE`` clause. So you could even do something like create a
filter for the last 30 days and apply it to a specific role, with a clause like
``date_field > DATE_SUB(NOW(), INTERVAL 30 DAY)``. It can also support multiple
conditions: ``client_id = 6 AND advertiser="foo"``, etc.

You can throw whatever you want in there to define the subset of the table you want the role in question to have access to.

All relevant ``Row level security filters`` will be ANDed together, so it's
possible to create a situation where two roles conflict in such a way as to
limit a table subset to empty. For example, the filters ``client_id=4`` and
and ``client_id=5``, applied to a role, will result in users of that role having
``client_id=4 AND client_id=5`` added to their query, which can never be true.