Building Access Control for OpenMetadata
In the 0.8.0 release of OpenMetadata we introduced Access Control for governing access for users that perform metadata operations. In this…

In the 0.8.0 release of OpenMetadata we introduced Access Control for governing access for users that perform metadata operations. In this article we explore the motivation and technical implementation details of the solution.

Motivation
One of the main goals of OpenMetadata is to provide a rich collaborative experience for users of data assets within an organization. As we build out product functionality that engages various users, it becomes critical to have some form of governance in place.
Having 100s of users in an organization updating metadata of data assets can lead to potential inaccurate and low quality metadata. This further hampers the discoverability and usage of data assets. Thus, governing user permissions through access control mechanisms becomes fundamental to support the evolution of the product to cater to various personas (Data Stewards, Data Consumers, Data Scientists, etc).
Research
We started with research to understand the best model for implementing access control in OpenMetadata. The following National Institute of Standards and Technology (NIST) papers helped us with our thought process to arrive at the solution:
- Role-Based Access Control (RBAC): Features and Motivations
- The NIST Model for Role-Based Access Control: Toward A Unified Standard
- Guide to Attribute Based Access Control (ABAC) Definition and Considerations We also did preliminary research on existing implementations, Apache Ranger and products offered by cloud vendors. Access control can become pretty complex as described in the diagram taken from the ABAC NIST paper (page 12).

We explored several aspects in the access control domain including RBAC role hierarchies, representation (expression language) for policies and policy evaluation. And followed our key design principle: KISS (Keep It Simple Stupid) — model personas as roles with a simple permissions model that is comprehensible to users of OpenMetadata without any documentation.
Solution
Our solution revolves around a simple model to assign a role to users that conform to the same persona and providing them a set of permissions, as described in the diagram below.
A User can be assigned Roles. A Role is associated with a Policy containing a set of Rules describing permissions. Common roles include Data Steward, Data Consumer and OpenMetadata Admin. The permissions pertain to various metadata operations that can be performed through OpenMetadata UI and APIs. The solution closely follows the flat RBAC (Role Based Access Control) model, described in the NIST paper.
OpenMetadata Admins have access to define new Roles, their associated permissions, and assign Roles to Users.

The same model dictates our user experience and UI design. Within the OpenMetadata community, we strive to keep our user-facing interfaces simple and self-explanatory. From a single page, an Admin can
- Create a new Role, such as Data Steward
- Add permissions (eg: Update Lineage) for the Data Steward Role
- See the list of users who have been assigned the Role and corresponding permissions

Implementation
We wanted to implement a native system within OpenMetadata that supports its access control requirements. With this, users do not need to deploy and manage yet another system for supporting access control. We thought further ahead on what potential use cases we would have to support in the future; such as granting permissions to update metadata for data assets with PII tags to only a certain set of users.
The following diagram from the ABAC NIST paper (page 15) provided us enough guidance to implement a system that is flexible enough to support any future requirements beyond the traditional RBAC model.

From the paper (paraphrased for simplicity),
- Subject requests access to object.
- Access Control Mechanism evaluates a) Rules, b) Subject Attributes, c) Object Attributes. Subject is given access to object if authorized.
- **Policy Information Point (PIP): **Serves as the retrieval source of attributes, or the data required for policy evaluation to provide the information needed by the PDP to make the decisions.
- Policy Administration Point (PAP): Provides a user interface for creating and managing policies, and storing these policies in the appropriate repository.
- Policy Enforcement Point (PEP): Enforces policy decisions in response to a request from a subject requesting access to a protected object; the access control decisions are made by the PDP.
- Policy Decision Point (PDP): Computes access decisions by evaluating the applicable policies. One of the main functions of the PDP is to mediate or deconflict policies. We leveraged the above concepts during our implementation.

In OpenMetadata, the users of the product are considered as the subjects, while the entities (metadata of tables, dashboards, etc) that we maintain in the database are objects. Metadata about users (role) and different entities (tags, entity type) which are stored in the database are considered attributes of the subjects and objects respectively. These can be accessed internally within OpenMetadata through the jdbi3 repository classes (PIP). We modeled the access control policy rule schema to conform to this concept. It is worth pointing out that the role of the user is modeled as a subject attribute, which becomes key to implementing RBAC.

We implemented a Policy REST API and Roles UI page that are accessible only for Admins to support policy administration(PAP), which allows them to add/edit permissions for Roles.

All metadata operations in OpenMetadata are performed through our well defined and documented entity (chart, table, etc) REST APIs. The REST API implementations leverage the internal Authorizer interface (DefaultAuthorizer), which enforces (PEP) policy decisions.
We implemented a PolicyEvaluator, which is based on the simple rules engine, jeasy/easy-rules. The policy rules are described based on the schema (figure 6), which are converted into a recognizable format by jeasy/easy-rules. The Policy Evaluator is the core of the access control mechanism responsible for making decisions (PDP). The PolicyEvaluator caches all the policies in-memory to avoid database calls to fetch policies during evaluation. The cache is refreshed when a policy change (add, delete, edit) is performed through the Policy REST API.
We did a prototype using casbin/jcasbin as we were implementing the Policy Evaluator. But we decided to choose jeasy/easy-rules with our own policy schema for the flexibility to support different attributes and custom conditions required for our implementation.
Putting all of these components together, the following is our architecture for enabling access control for metadata operations performed on OpenMetadata.

Example Walkthrough
A role named DataSteward with Update Description permission is created through the Roles UI (figure 7). The corresponding rule is available to the Policy Evaluator.

At the REST API layer, we use the Authentication Context to identify the user (subject). Majority of the updates to entities in OpenMetadata are performed through the PATCH REST API. We use JSON Patch (eg: table PATCH API) for updating entities. This allows us to map the PATCH operation to the appropriate Metadata Operation that the user requested.

The user, the metadata operation and the entity being updated are used as inputs to the Policy Evaluator. The Policy Evaluator uses the different inputs along with the rules to determine if the user has permission to perform the operation. In this example, if the user has the role Data Steward, the user is able to update the description (as indicated in figure 10).

What’s Next
We plan to evolve Role Based Access Control feature as we get feedback from the community. We also plan to integrate with existing policy stores like Apache Ranger and Apache Sentry. This will enable organizations to manage their policies from existing solutions and use them in OpenMetadata.
Besides access control, we have a lot more exciting new features lined up for development in our upcoming releases. I’m particularly excited about the project’s vision on enabling collaboration (sneak peek here).
We are a growing community of globally distributed passionate developers working on getting metadata right and enabling collaboration with data. Join us on this exciting journey; talk to us on Slack and check out our GitHub repo!

Comments
Join the discussionNo comments yet. Be the first to comment.




