← 返回首页
feat: Feast Security Model (aka RBAC) by dmartinol · Pull Request #4380 · feast-dev/feast · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

feat: Feast Security Model (aka RBAC)#4380

Merged
franciscojavierarceo merged 170 commits into
feast-dev:masterfrom
RHEcosystemAppEng:feast-rbac
Aug 21, 2024
Merged

feat: Feast Security Model (aka RBAC)#4380
franciscojavierarceo merged 170 commits into
feast-dev:masterfrom
RHEcosystemAppEng:feast-rbac

Conversation

dmartinol commented Aug 5, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

This PR proposes a permission model to enable the store administrator to identify which users are allowed to execute operations on each managed resource.

Granular permission enforcement identifies user roles (*) allowed to execute requested operations on
resources matched by type, optional name patterns, and tags:

Permission( name="reader", types=[FeatureView], name_pattern=".*risky.*", policy=RoleBasedPolicy(roles=["trusted"]), actions=[AuthzedAction.QUERY_OFFLINE], )

Such resource partitioning allows teams working on the same set of features to share the same feature store, mitigating the risk of unexpected changes due to unauthorized operations.

The PR also adds support for managing authorization tokens from either OIDC or Kubernetes, in a configurable way.

Permission authorization enforcement is performed when requests are executed through one of the Feast (Python) servers:

  • The online feature server (REST)
  • The offline feature server (Arrow Flight)
  • The registry server (grpc)
project: foo registry: "registry.db" provider: local online_store: path: foo entity_key_serialization_version: 2 auth: type: kubernetes

To avoid backward incompatibility with existing installations, the default authorization is not enabled (e.g., auth type
is set to no-auth) .

Feast clients can use the same configuration options to automatically retrieve the token from the authorization server
and transparently secure all the remote requests. This pattern allows the client to use the authorization infrastructure without affecting the business code.

By design, only the client requests are validated: once the endpoint execution is permitted for the original client request,
all the next service-to-service requests generated by the execution flow are automatically allowed.

Validation is typically implemented within the endpoint functions using an assertion-like style:

assert_permissions( resource=FeatureView.from_proto(request.feature_view), actions=[AuthzedAction.WRITE_ONLINE], )

The PR also includes:

  • Docs update to provide general description of the feature
  • Unit test for all the new modules
  • Integration tests to verify the server behavior while adding the authorization components
  • New permission CLI command with sub-commands to explore and troubleshoot the permissions settings

Fully working examples both Kubernetes and OIDC authorization will be in another next PR.

(*) Match by role is the predefined option, but it can be customized to support any other user validation.

Other features coming soon

Which issue(s) this PR fixes:

Fixes #4198

dmartinol changed the title Feast Security Model (aka RBAC) feat: Feast Security Model (aka RBAC) Aug 5, 2024
redhatHameed force-pushed the feast-rbac branch 3 times, most recently from 13c57d4 to c456222 Compare August 5, 2024 16:27
dmartinol marked this pull request as ready for review August 5, 2024 17:24

tokoko commented Aug 5, 2024

Copy link
Copy Markdown
Collaborator

This is gonna take a while 😄

Comment thread sdk/python/feast/registry_server.py Outdated Show resolved Hide resolved
Comment thread setup.py Outdated Show resolved Hide resolved
Comment thread protos/feast/core/Permission.proto Outdated Show resolved Hide resolved
Comment thread examples/rbac/client/admin_user_resources.yaml Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/reference/registry/registry-permissions.md Show resolved Hide resolved

HaoXuAI commented Aug 6, 2024

Copy link
Copy Markdown
Collaborator

Hey, this is a great feature and also a big PR. Maybe it's better to walk us through the design, implementation, demo etc. in the next standup to get us understanding it better?

redhatHameed commented Aug 6, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Hey, this is a great feature and also a big PR. Maybe it's better to walk us through the design, implementation, demo etc. in the next standup to get us understanding it better?

sure, this will be a good idea.
cc @jeremyary @dmartinol

redhatHameed force-pushed the feast-rbac branch 2 times, most recently from 9b8f88d to 0a3a3ba Compare August 7, 2024 13:13

dmartinol commented Aug 7, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

@tokoko we realized that when the remote registry (transparently) invokes a server API, there's no way to catch a FeatureViewNotFoundException as in this example, because the server raises an InactiveRpcError instead.

Should we create an issue to extend the registry server to add error details and the registry client to convert the grpc error into the original Exception? I don't think this has to be part of the RBAC commit.

@redhatHameed FYI this is also the root cause of the error in the demo setup

An error occurred: <_InactiveRpcError of RPC that terminated with: status = StatusCode.UNKNOWN details = "Exception calling application: Feature view driver_hourly_stats_fresh does not exist in project server" debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Exception calling application: Feature view driver_hourly_stats_fresh does not exist in project server", grpc_status:2, created_time:"2024-08-07T15:00:29.930731564+00:00"}" >

tokoko commented Aug 7, 2024

Copy link
Copy Markdown
Collaborator

@dmartinol sure, sounds like a bug to me. That should be tested in registry tests as well, I think. please go ahead and create a ticket.

Copy link
Copy Markdown
Member

In the PR template you say

"To avoid backward compatibilities with existing installations, the default authorization is not enabled (e.g., auth type is set to no-auth) ."

Did you mean "To avoid backward incompatibility with.."

Comment thread docs/SUMMARY.md Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
305 hidden items Load more…
@@ -0,0 +1,133 @@
# Role-Based Access Control (RBAC) in Feast Feature Store

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment
Suggested change
# Role-Based Access Control (RBAC) in Feast Feature Store
# Role-Based Access Control (RBAC) in Feast


## Introduction

Role-Based Access Control (RBAC) is a security mechanism that restricts access to resources based on the roles of individual users within an organization. In the context of the Feast Feature Store, RBAC ensures that only authorized users or groups can access or modify specific resources, thereby maintaining data security and operational integrity.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment
Suggested change
Role-Based Access Control (RBAC) is a security mechanism that restricts access to resources based on the roles of individual users within an organization. In the context of the Feast Feature Store, RBAC ensures that only authorized users or groups can access or modify specific resources, thereby maintaining data security and operational integrity.
Role-Based Access Control (RBAC) is a security mechanism that restricts access to resources based on the roles of individual users within an organization. In the context of the Feast Feature Store, RBAC ensures that only authorized users or groups can access or modify specific resources, thereby maintaining data security and operational integrity.
Suggested change
Role-Based Access Control (RBAC) is a security mechanism that restricts access to resources based on the roles of individual users within an organization. In the context of the Feast Feature Store, RBAC ensures that only authorized users or groups can access or modify specific resources, thereby maintaining data security and operational integrity.
Role-Based Access Control (RBAC) is a security mechanism that restricts access to resources based on the roles of individual users within an organization. In the context of the Feast, RBAC ensures that only authorized users or groups can access or modify specific resources, thereby maintaining data security and operational integrity.


## Functional Requirements

The RBAC implementation in Feast Feature Store is designed to:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment
Suggested change
The RBAC implementation in Feast Feature Store is designed to:
The RBAC implementation in Feast is designed to:


## Business Goals

The primary business goals of implementing RBAC in the Feast Feature Store are:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment
Suggested change
The primary business goals of implementing RBAC in the Feast Feature Store are:
The primary business goals of implementing RBAC in the Feast are:


The primary business goals of implementing RBAC in the Feast Feature Store are:

1. **Feature Sharing**: Enable multiple teams to share the feature store while ensuring controlled access to data partitions. This allows for collaborative work without compromising data security.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment
Suggested change
1. **Feature Sharing**: Enable multiple teams to share the feature store while ensuring controlled access to data partitions. This allows for collaborative work without compromising data security.
1. **Feature Sharing**: Enable multiple teams to share the feature store while ensuring controlled access. This allows for collaborative work without compromising data security.


## Reference Architecture

The Feast Feature Store operates as a collection of connected services, each enforcing authorization permissions. The architecture is designed as a distributed microservices system with the following key components:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment
Suggested change
The Feast Feature Store operates as a collection of connected services, each enforcing authorization permissions. The architecture is designed as a distributed microservices system with the following key components:
Feast operates as a collection of connected services, each enforcing authorization permissions. The architecture is designed as a distributed microservices system with the following key components:


The Feast Feature Store operates as a collection of connected services, each enforcing authorization permissions. The architecture is designed as a distributed microservices system with the following key components:

- **Service Endpoints**: These enforce authorization permissions, ensuring that only authorized requests are processed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Can you confirm that these three are correct? i know this was generated with an LLM (which is fine!) but I think some of this may not be right.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

that's correct, simplified it more .

note Service-to-Service Communication this feature not yet part of this PR will be implementation next PRs.

- **Action**: A logical operation performed on a resource, such as Create, Describe, Update, Delete, query, or write operations.
- **Policy**: A set of rules that enforce authorization decisions on resources. The default implementation uses role-based policies.

### Configuring Permissions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Please remove this section as the architecture is meant to give a motivation and not the implementation details.

franciscojavierarceo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Last changes. The architecture section should be pretty high level. I believe some of what you added to a PR is included in other documentation. If it's not, can you add it to the components section? I like the documentation, I just think it's better served under the components section.

After that I think we're good.

)
```

### Enforcing Permission Policy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Please remove this section as well.

Comment on lines +64 to +73
```python
assert_permissions(
resource=feature_service,
actions=[AuthzedAction.QUERY_ONLINE]
)
```

## Use Cases

### Tag-Based Permission

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Please remove this section as well.

)
```

### Name-Based Permission

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Please remove this section as well.

3. **Policy Enforcer**: Validates the secured endpoint against the retrieved user details.
4. **Token Injector**: Adds the authorization token to each secured request header.

### OIDC Authorization

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Please remove this section as well.

auth_server_url: _OIDC_SERVER_URL_
```

### Kubernetes Authorization

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Please remove this section as well.

…emory. Signed-off-by: Lokesh Rangineni <19699092+lokeshrangineni@users.noreply.github.com>

redhatHameed commented Aug 20, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Last changes. The architecture section should be pretty high level. I believe some of what you added to a PR is included in other documentation. If it's not, can you add it to the components section? I like the documentation, I just think it's better served under the components section.

After that I think we're good.

Agreed was repetition these are already aded into components section, hence removed from here.

Comment thread README.md
[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](https://github.com/feast-dev/feast/blob/master/LICENSE)
[![GitHub Release](https://img.shields.io/github/v/release/feast-dev/feast.svg?style=flat&sort=semver&color=blue)](https://github.com/feast-dev/feast/releases)

## Join us on Slack!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Can you revert this change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Done.

Signed-off-by: Abdul Hameed <ahameed@redhat.com>
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/getting-started/concepts/permission.md Outdated Show resolved Hide resolved
Comment thread docs/reference/feature-servers/offline-feature-server.md Outdated Show resolved Hide resolved
Comment thread docs/reference/feature-servers/offline-feature-server.md Outdated Show resolved Hide resolved
Signed-off-by: Abdul Hameed <ahameed@redhat.com>

franciscojavierarceo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Amazing work here, thanks for taking in all of the changes!

/lgtm

redhatHameed commented Aug 21, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

@tokoko @franciscojavierarceo Thanks for taking time to review and approve this

Next PRs will handle:

  1. Working examples of RBAC configuration with OIDC and Kubernetes.
  2. Solution for intra-service communication
  3. Fix the dependencies to make it not required in setup.py
  4. Refactoring the OIDC authentication to use discovery URL

Also if there is no any further concern can you merge this Thanks

cc @jeremyary @dandawg

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security Model

8 participants

Footer

© 2026 GitHub, Inc.