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

trino-opa-plugin #9787

Closed
rodolfototaro opened this issue Oct 27, 2021 · 9 comments
Closed

trino-opa-plugin #9787

rodolfototaro opened this issue Oct 27, 2021 · 9 comments

Comments

@rodolfototaro
Copy link

Developing a plugin that provides a SystemAccessControl implementation that delegates authorization decisions to OPA (Open Policy Access) technology

@kokosing
Copy link
Member

OPA is a framework. You would need to first implement authorization model in OPA that you would need to use. Or do you think about a generic plugin that communicates with with OPA but authorization model is some injected into a plugin via configuration?

Can you please elaborate how you would like to address this?

@rodolfototaro
Copy link
Author

rodolfototaro commented Oct 27, 2021

I'm already implementing a plugin for OPA that delegates the decision to OPA Server. So the plugin just queries OPA server with parameters of the authorization method and address the responses from it. i.e.

for the method
default Set<String> filterCatalogs(SystemSecurityContext context, Set<String> catalogs)

the plugin ask to OPA server to evaluate the rule filterCatalogs with the following input:

{
  "catalogs": [
    "system",
    "jmx",
    "tpch"
  ],
  "context": {
    "identity": {
      "user": "bob",
      "groups": [],
      "principal": {
        "name": "bob"
      }
    }
  }
}

the result will be

{
  "result": [
    "tpch"
  ]
}

the policy is like the following

filterCatalogs[catalog]{
    check_any_catalog_access(input.catalogs[i])
    catalog = input.catalogs[i]
}

[omissis]

For validating the approach I wrote OPA policies implementing the same logics of the FileBasedSystemAccessControl reading json configuration as OPA data files. I ported the current test suite of FileBasedSystemAccessControl in my plugin. This set of rego files could be used as a starting point for customizing your opa based access control.

@kokosing
Copy link
Member

Would it be possible that we run same set of tests for your OPA and FileBasedSystemAccessControl to make sure they are coherent? The best if we would simply reuse tests but only have different infrastructure.

@rodolfototaro
Copy link
Author

IMO It is not needed that they are coherent. The goal is to test the plugin opa wrapper and to validate the approach. Moreover you could use the rego files written for the tests as a starting point for your policies but if you need the behaviour of the FileBasedSystemAccessControl you can use it directly.

@kokosing
Copy link
Member

IMO It is not needed that they are coherent.

I mean we should provide rego files for OPA where we would be able to get the same behavior. FileBasedSystemAccessControl is something that we maintain for a long time and it has lot thoughts inside. I think being able to follow the same authorization model in OPA would validate the approach. Otherwise, it will be a challenge to make sure that authorization model you might have with OPA is secure.

@kokosing
Copy link
Member

But I hear your point. We could have some kind of API that we require OPA to provide and users might implement it differently according to their needs. However we need to have something decent that users can use out of the box. Like a recommended template.

@vagaerg
Copy link
Member

vagaerg commented Jun 16, 2023

We've been in touch with the developers of https://github.com/stackabletech/trino-opa-authorizerhttps://github.com/stackabletech/trino-opa-authorizer and created a fork of their code to be mainlined and with some tweaks.

This is a WIP, but see #17940

@YuriyGavrilov
Copy link

+1

@ebyhr
Copy link
Member

ebyhr commented Apr 12, 2024

Closing as #19532

@ebyhr ebyhr closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants