Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
OPA: Implement row level filtering and column masking #20921
OPA: Implement row level filtering and column masking #20921
Changes from all commits
610b160
7eb96fd
50cc016
532e4b6
be8b8bc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, it would be nice if the OPA server had a configration endpoint (like Oauth), which told us these URI along with the batch URI. We could then either call this once during setup, or periodically in the background.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great idea, we were playing with a similar concept. The one thing I'm unsure about is allowing a configuration endpoint to determine whether row filtering is applied at all, for instance - as that feels more like a configuration responsibility. Kind of like if the OAuth config endpoint allowed you to disable auth altogether.
Not opposed to it, just some thoughts.
An alternative:
What's interesting is that we don't technically need these to be different URIs, they could just be different keys from the response and we could do everything OPA-side without including another type of request.
Suppose we had:
opa.policy.uri = https://opa/v1/data/my_policy/allow
opa.policy.batched-uri = https://opa/v1/data/my_policy/batchAllow
opa.policy.row-filters-uri = https://opa/v1/data/my_policy/rowFilters
opa.policy.column-masking-uri = https://opa/v1/data/my_policy/columnMask
This is equivalent to querying
https://opa/v1/data/my_policy
for all possible types of request and pulling the relevant field from the response (allow
,batchAllow
,rowFilters
orcolumnMask
).The OPA policy itself can even directly determine what result to provide so that Trino doesn't need to pop fields from the response manually. This is because the request unequivocally determines what Trino is looking for:
operation
isGetRowFilters
: the relevant result is the row filters decisionoperation
isGetColumnMask
: the relevant result is the column mask decisionaction.filterResources
is present: the relevant result is the batch filtering decisionallow
decisionSome care would need to be exercised for performance (but we can provide a small rego wrapper to deal with this)
The config would then become:
opa.policy.unified-uri
(or whatever we call this new "catch-all" URI)opa.policy.enable-row-filtering
opa.policy.enable-column-masking
The last two would allow us to disable row filtering and column masking from the config in case there's performance concerns
Maybe we could take this into an issue? CC @sbernauer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds interesting. Let's discuss on slack