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

feat: Feast Security Model (aka RBAC) #4380

Merged
merged 170 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
4390a41
initial commit
dmartinol Jun 21, 2024
a4859b7
fixed linting issues (but 1)
dmartinol Jun 21, 2024
1f6d6f3
deleted AuthzedResource and moved types to the Permission class
dmartinol Jun 21, 2024
a2fa5de
using pytest.mark.parametrize tests
dmartinol Jun 24, 2024
d906554
moved decorator to decorator module
dmartinol Jun 24, 2024
21d29a8
parametrized decision tests
dmartinol Jun 24, 2024
f477add
Added matcher and action modules. Added global assert_permissions fun…
dmartinol Jun 24, 2024
30ee844
fixed linting error
dmartinol Jun 24, 2024
183d0c4
Managing with_subclasses flag and overriding it in case it's an abstr…
dmartinol Jun 24, 2024
e4a0f9f
Permission includes a single Policy
dmartinol Jun 25, 2024
b5c5af1
completed docstrings for permissions package
dmartinol Jun 26, 2024
dd15dd9
fixed inter issues
dmartinol Jun 26, 2024
7d7a787
Changed roles matching rule from "all" to "any"
dmartinol Jun 26, 2024
bb857e2
Introducing permission framework and authorization manager in user gu…
dmartinol Jun 27, 2024
abf384f
removed test code
dmartinol Jun 27, 2024
8fb5227
hiding sensitive data (false positive, anyway)
dmartinol Jun 27, 2024
ae01740
Added filter_only flag to assert_permissions and returning a list of …
dmartinol Jul 1, 2024
7b02d26
added the option to return the single resource, or None
dmartinol Jul 1, 2024
ad6765b
separate validating functions: assert_permission and filtered_resources
dmartinol Jul 1, 2024
b1fbdb6
Store and Manage permissions in the Registry
tmihalac Jun 27, 2024
a9d7a92
Applied review comments
tmihalac Jun 28, 2024
1534a8d
Store and Manage permissions in the Registry
tmihalac Jun 28, 2024
a21845d
Store and Manage permissions in the Registry
tmihalac Jun 28, 2024
e06a631
Store and Manage permissions in the Registry
tmihalac Jul 1, 2024
4fadb7b
Store and Manage permissions in the Registry
tmihalac Jun 27, 2024
7d17c78
Store and Manage permissions in the Registry
tmihalac Jun 28, 2024
ec079a6
Store and Manage permissions in the Registry
tmihalac Jun 28, 2024
aef0747
Store and Manage permissions in the Registry
tmihalac Jul 1, 2024
14ea4c2
replaced aggregated actions with aliases for QUERY and WRITE and ALL
dmartinol Jul 2, 2024
98eed44
Updated user guide
dmartinol Jul 2, 2024
78decaa
Updated enum in proto
dmartinol Jul 2, 2024
a02602d
Store and Manage permissions in the Registry
tmihalac Jul 2, 2024
6fba046
Store and Manage permissions in the Registry
tmihalac Jul 3, 2024
4408be5
Added permission assert check for registry server, offline server, on…
redhatHameed Jun 25, 2024
34c151c
Fix linter after rebase
redhatHameed Jul 5, 2024
aa0758c
CLI command "feast permissions list"
tmihalac Jul 8, 2024
fbe1bd5
CLI command "feast permissions list"
tmihalac Jul 8, 2024
87710cb
CLI command "feast permissions list"
tmihalac Jul 8, 2024
e9ff6e6
added the documents reference for permissions for online, offline, re…
redhatHameed Jul 5, 2024
679579e
Incorporating code review comments to parse the auth block from the f…
lokeshrangineni Jul 9, 2024
1085b99
definition and integration of auth manager in feast offline and onlin…
dmartinol Jul 8, 2024
7bfc945
typo
dmartinol Jul 9, 2024
d988846
duplicated if
dmartinol Jul 9, 2024
07211da
renamed functions with long name
dmartinol Jul 9, 2024
5386419
using User class instead of RoleManager (completely removed)
dmartinol Jul 9, 2024
0548aea
Feed SecurityManager with Registry instance to fetch the actual permi…
dmartinol Jul 9, 2024
a921f07
fixed linter
dmartinol Jul 9, 2024
f0b95c8
review comments
dmartinol Jul 9, 2024
f8a7140
fixed broken IT
dmartinol Jul 10, 2024
95eca10
Adding registry server (UT to be completed)
dmartinol Jul 10, 2024
8d42fcf
fix linter
dmartinol Jul 10, 2024
ef6d21f
passing auth manager type from config
dmartinol Jul 10, 2024
86a2e6b
used auth config to set auth manager type
redhatHameed Jul 9, 2024
9fc6db7
inject the user details
redhatHameed Jul 9, 2024
ea97997
created decorator function and applied to arrow function for injectin…
redhatHameed Jul 9, 2024
711374a
code review fixes including the unit test and integration test as sug…
redhatHameed Jul 10, 2024
6899f41
Implementation of oidc client authentication. (#40)
lokeshrangineni Jul 10, 2024
7b6561e
Client module-grpc
tmihalac Jul 10, 2024
bc086ef
Client module-grpc
tmihalac Jul 11, 2024
fb48f1a
Client module-grpc
tmihalac Jul 11, 2024
0158cfd
Client module-grpc
tmihalac Jul 11, 2024
2dbf6b1
Client module-grpc
tmihalac Jul 11, 2024
6ac6c01
Client module-grpc
tmihalac Jul 12, 2024
dc99e59
Client module-grpc
tmihalac Jul 12, 2024
aaeb7b7
Client module-grpc
tmihalac Jul 12, 2024
23ac8a6
added auth configuration for arrow flight client
redhatHameed Jul 11, 2024
c7e92a0
Client module-grpc
tmihalac Jul 12, 2024
77abd12
fix linter
dmartinol Jul 12, 2024
c6e9638
Propagating auth config to token parser in server init
dmartinol Jul 12, 2024
53d7d10
adding headers and client_secret to token request
dmartinol Jul 12, 2024
fcd7419
working E2E test of authenticated registy server
dmartinol Jul 12, 2024
f3e36d2
renamed test
dmartinol Jul 12, 2024
811dc83
fixed broken test
dmartinol Jul 12, 2024
7dca956
fix rebase issues
dmartinol Jul 12, 2024
d2a9f6c
fix rebase issues
dmartinol Jul 12, 2024
92198de
Adding the auth client documentations and unit testing for auth clien…
lokeshrangineni Jul 12, 2024
2cf1f00
Adding the auth client documentations and unit testing for auth clien…
lokeshrangineni Jul 12, 2024
74fe957
Incorporating code review comments.
lokeshrangineni Jul 15, 2024
3b43c04
Incorporating code review comments.
lokeshrangineni Jul 15, 2024
a83c5a6
Introducing permission framework and authorization manager in user gu…
dmartinol Jun 27, 2024
ce6413b
CLI command "feast permissions list"
tmihalac Jul 15, 2024
a400f8f
Client module-grpc
tmihalac Jul 15, 2024
dcec0cb
Fix auth tests with permissions
tmihalac Jul 22, 2024
db1cfd6
Fix auth tests with permissions
tmihalac Jul 24, 2024
93e6f4d
Fix auth tests with permissions
tmihalac Jul 24, 2024
a0a68ef
Fix auth tests with permissions
tmihalac Jul 24, 2024
b4e0e08
Moved the common fixtures to the root conftest.py or auth_permissions…
lokeshrangineni Jul 25, 2024
137fed1
added check and list-roles subcommands
dmartinol Jul 25, 2024
716e099
typo
dmartinol Jul 25, 2024
bacd4a1
added comment in cli_utils to remind the original function from which…
dmartinol Jul 26, 2024
d76e3c4
1) Updating the existing integration test with auth permissions confi…
lokeshrangineni Jul 26, 2024
5fff1ff
Moved the common fixtures to the root conftest.py or auth_permissions…
lokeshrangineni Jul 25, 2024
23d9a31
Adding missed dependency and regenerated the requirements files.
lokeshrangineni Jul 22, 2024
49fd90d
1) Updating the existing integration test with auth permissions confi…
lokeshrangineni Jul 26, 2024
6a96e70
1) Fixing an issue with the way getting markers after changing the fi…
lokeshrangineni Jul 28, 2024
9308731
Fixed bug in GetPermission API
dmartinol Jul 30, 2024
6538db6
Permission CRUD test
dmartinol Jul 30, 2024
c9bdbbe
Added feast-rbac example
redhatHameed Jul 17, 2024
3ab7087
Added support to read the token from enviroment variable to run from …
redhatHameed Jul 17, 2024
b260756
Fix the header for arrow fligth
redhatHameed Jul 17, 2024
269cc33
fix the header issue
redhatHameed Jul 17, 2024
741010d
added permissions apply file
redhatHameed Jul 17, 2024
8c1993b
set the user in the grpc server
redhatHameed Jul 18, 2024
6558760
added roles and updated permission with all roles
redhatHameed Jul 19, 2024
cb4add7
updated chart to include the service account
redhatHameed Jul 19, 2024
bf4ac90
created client example with roles and updated installation/cleanup sc…
redhatHameed Jul 22, 2024
d7defc1
rebased with master
redhatHameed Jul 31, 2024
190e609
Moved the common fixtures to the root conftest.py or auth_permissions…
lokeshrangineni Jul 25, 2024
542f389
Fixed DecisionStrategy not persisted
tmihalac Jul 27, 2024
bdd4fd6
Fixed DecisionStrategy not persisted
tmihalac Jul 31, 2024
571d9c6
Fixed DecisionStrategy not persisted
tmihalac Aug 1, 2024
de34a11
Revert "Fix decision strategy not saved"
dmartinol Aug 2, 2024
900bc86
Dropped global decision strategy
dmartinol Aug 2, 2024
065c99c
updated rbac demo example
redhatHameed Aug 1, 2024
444ae71
Adding permissions directly instead of from the common place for the …
lokeshrangineni Aug 2, 2024
86ec133
Initial Draft version to the tests with remote offline server with OI…
lokeshrangineni Aug 2, 2024
1fcb89d
Abstracting the specific code for Offline Permissions by creating new…
lokeshrangineni Aug 2, 2024
787105b
Formatting the python files using make format-python.
lokeshrangineni Aug 2, 2024
2f169df
Separated the permissions for online, offline and registry servers. m…
lokeshrangineni Aug 2, 2024
af35739
Separated the permissions for online, offline and registry servers. m…
lokeshrangineni Aug 2, 2024
0333c56
Created the grpc client auth header interceptor and removed the manua…
lokeshrangineni Aug 2, 2024
9c42cfb
Created the grpc client auth header interceptor and removed the manua…
lokeshrangineni Aug 2, 2024
b51e58c
fix: java to proto failing
tmihalac Aug 6, 2024
bc1f30c
CLI command "feast permissions list"
tmihalac Jul 8, 2024
63fa1e8
Moved the common fixtures to the root conftest.py or auth_permissions…
lokeshrangineni Jul 25, 2024
8c17cf8
fix: java to proto failing
tmihalac Aug 6, 2024
035f197
Adding the extra writer permission to fix the integration test issue …
lokeshrangineni Aug 6, 2024
f98b8d1
Try to fix java integration test - ModuleNotFoundError: No module nam…
tmihalac Aug 6, 2024
7c7ec37
fix java integration test - ModuleNotFoundError: No module named 'jwt'
tmihalac Aug 6, 2024
414cd48
fix java integration test - ModuleNotFoundError: No module named 'kub…
tmihalac Aug 6, 2024
7631099
Adding missing permissions for offline store test cases - classes Fil…
lokeshrangineni Aug 6, 2024
54a8392
Updating the offline integration test permissions.
lokeshrangineni Aug 7, 2024
366e288
updated test.py file for rbac-example
redhatHameed Aug 7, 2024
cdb19fa
fix the DeleteFeatureView function to handle stream feature view type
redhatHameed Aug 7, 2024
3b06316
Updating permissions of the integration test cases to address code re…
lokeshrangineni Aug 8, 2024
61f5ef1
Incorporating the code review comments from Francisco on upstream PR.
lokeshrangineni Aug 8, 2024
5b67a6c
Update docs/getting-started/concepts/permission.md
dmartinol Aug 8, 2024
ab454be
Update docs/getting-started/concepts/permission.md
dmartinol Aug 8, 2024
8cfe18f
Update docs/getting-started/concepts/permission.md
dmartinol Aug 8, 2024
7e8bfaa
Small fixes (#71)
dmartinol Aug 8, 2024
6418549
commented/removed oidc tests to verify integration test
redhatHameed Aug 8, 2024
f79b6ec
Enabling the keycloak related integration tests and also initializing…
lokeshrangineni Aug 8, 2024
bebd292
Making number of workers back to 8 and enabled the test_remote_online…
lokeshrangineni Aug 8, 2024
e6b5e4c
Making number of workers to 4.
lokeshrangineni Aug 8, 2024
33bb445
Incorporating the code review comments from Tornike to use @pytest.ma…
lokeshrangineni Aug 9, 2024
12895c0
Reverting number of workers from 8 to 4.
lokeshrangineni Aug 9, 2024
9951489
Reverting number of workers from 8 to 4. Reverting the marker @pytest…
lokeshrangineni Aug 9, 2024
71e4044
Reverting number of workers from 8 to 4 for make target test-python-i…
lokeshrangineni Aug 9, 2024
fd1243b
Added the arrow flight interceptor to inject the auth header. (#68)
lokeshrangineni Aug 11, 2024
807c0f5
removed with_subclasses option (it's the default and unique behavior)
dmartinol Aug 12, 2024
a8abd21
a full, minimal, reproducible example of the RBAC feature
dmartinol Aug 9, 2024
1183fbd
Add missing required_tags to permission object and cli info
tmihalac Aug 13, 2024
063a87f
Fixed the registry apply function assertation
redhatHameed Aug 12, 2024
4922b8b
removed the examples
redhatHameed Aug 14, 2024
7c9389d
Integrated comment
dmartinol Aug 14, 2024
3ff811e
removed the firebase depdency and fix the doc conflicts
redhatHameed Aug 14, 2024
0498d3f
Introducing permission framework and authorization manager in user gu…
dmartinol Jun 27, 2024
23c829f
Permission resources miss the created_timestamp and last_updated_time…
tmihalac Aug 14, 2024
6c5e2c7
remove error incase if user has no roles assinged incase unthorized user
redhatHameed Aug 16, 2024
8409014
renamed READ action to DESCRIBE
dmartinol Aug 19, 2024
fdf331f
Specified authorization manager and authorization configuration
dmartinol Aug 19, 2024
3a4f122
fix the linter and remove subclass from doc
redhatHameed Aug 19, 2024
acf2190
addressed the pr reivew comments
redhatHameed Aug 20, 2024
136719e
Incorporating code review comment and this file is not needed.
lokeshrangineni Aug 19, 2024
9e3efe2
Addressed the review comments on the PR
redhatHameed Aug 20, 2024
5534044
Reducing the markers from 8 to 4 to see if it fixes the issues with m…
lokeshrangineni Aug 20, 2024
09893af
addresses feedback on rbac doc
redhatHameed Aug 20, 2024
2581335
rename action name from QUERY to READ
redhatHameed Aug 20, 2024
f04150a
Merge pull request #84 from redhatHameed/query-to-read
redhatHameed Aug 20, 2024
3f1cd9c
fix the doc to replace query with read
redhatHameed Aug 21, 2024
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ test-python-unit:
python -m pytest -n 8 --color=yes sdk/python/tests

test-python-integration:
python -m pytest -n 8 --integration --color=yes --durations=10 --timeout=1200 --timeout_method=thread \
python -m pytest -n 4 --integration --color=yes --durations=10 --timeout=1200 --timeout_method=thread \
-k "(not snowflake or not test_historical_features_main)" \
sdk/python/tests

test-python-integration-local:
FEAST_IS_LOCAL_TEST=True \
FEAST_LOCAL_ONLINE_CONTAINER=True \
python -m pytest -n 8 --color=yes --integration --durations=5 --dist loadgroup \
python -m pytest -n 4 --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
-k "not test_lambda_materialization and not test_snowflake_materialization" \
sdk/python/tests
dmartinol marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [Feature retrieval](getting-started/concepts/feature-retrieval.md)
* [Point-in-time joins](getting-started/concepts/point-in-time-joins.md)
* [Registry](getting-started/concepts/registry.md)
* [Role-Based Access Control (RBAC)](getting-started/architecture/rbac.md)
* [\[Alpha\] Saved dataset](getting-started/concepts/dataset.md)
* [Architecture](getting-started/architecture/README.md)
* [Overview](getting-started/architecture/overview.md)
Expand Down
4 changes: 4 additions & 0 deletions docs/getting-started/architecture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@
{% content-ref url="model-inference.md" %}
[model-inference.md](model-inference.md)
{% endcontent-ref %}

{% content-ref url="rbac.md" %}
[rbac.md](rbac.md)
{% endcontent-ref %}
4 changes: 4 additions & 0 deletions docs/getting-started/architecture/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ typically your Offline Store). We are exploring adding a default streaming engin
write patterns](write-patterns.md) to your application

* We recommend [using Python](language.md) for your Feature Store microservice. As mentioned in the document, precomputing features is the recommended optimal path to ensure low latency performance. Reducing feature serving to a lightweight database lookup is the ideal pattern, which means the marginal overhead of Python should be tolerable. Because of this we believe the pros of Python outweigh the costs, as reimplementing feature logic is undesirable. Java and Go Clients are also available for online feature retrieval.

* [Role-Based Access Control (RBAC)](rbac.md) 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.


Binary file added docs/getting-started/architecture/rbac.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions docs/getting-started/architecture/rbac.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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, 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 is designed to:

- **Assign Permissions**: Allow administrators to assign permissions for various operations and resources to users or groups based on their roles.
- **Seamless Integration**: Integrate smoothly with existing business code without requiring significant modifications.
- **Backward Compatibility**: Maintain support for non-authorized models as the default to ensure backward compatibility.

## Business Goals

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

1. **Feature Sharing**: Enable multiple teams to share the feature store while ensuring controlled access. This allows for collaborative work without compromising data security.
2. **Access Control Management**: Prevent unauthorized access to team-specific resources and spaces, governing the operations that each user or group can perform.

## Reference Architecture

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:

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

Choose a reason for hiding this comment

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

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
Contributor

Choose a reason for hiding this comment

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

that's correct, simplified it more .

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

- **Client Integration**: Clients authenticate with feature servers by attaching authorization token to each request.
- **Service-to-Service Communication**: This is always granted.

![rbac.jpg](rbac.jpg)

## Permission Model

The RBAC system in Feast uses a permission model that defines the following concepts:

- **Resource**: An object within Feast that needs to be secured against unauthorized access.
- **Action**: A logical operation performed on a resource, such as Create, Describe, Update, Delete, Read, or write operations.
- **Policy**: A set of rules that enforce authorization decisions on resources. The default implementation uses role-based policies.



## Authorization Architecture

The authorization architecture in Feast is built with the following components:

- **Token Extractor**: Extracts the authorization token from the request header.
- **Token Parser**: Parses the token to retrieve user details.
- **Policy Enforcer**: Validates the secured endpoint against the retrieved user details.
- **Token Injector**: Adds the authorization token to each secured request header.







4 changes: 4 additions & 0 deletions docs/getting-started/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@
{% content-ref url="provider.md" %}
[provider.md](provider.md)
{% endcontent-ref %}

{% content-ref url="authz_manager.md" %}
[authz_manager.md](authz_manager.md)
{% endcontent-ref %}
102 changes: 102 additions & 0 deletions docs/getting-started/components/authz_manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Authorization Manager
An Authorization Manager is an instance of the `AuthManager` class that is plugged into one of the Feast servers to extract user details from the current request and inject them into the [permissions](../../getting-started/concepts/permissions.md) framework.

{% hint style="info" %}
**Note**: Feast does not provide authentication capabilities; it is the client's responsibility to manage the authentication token and pass it to
the Feast server, which then validates the token and extracts user details from the configured authentication server.
{% endhint %}

Two authorization managers are supported out-of-the-box:
* One using a configurable OIDC server to extract the user details.
* One using the Kubernetes RBAC resources to extract the user details.

These instances are created when the Feast servers are initialized, according to the authorization configuration defined in
their own `feature_store.yaml`.

Feast servers and clients must have consistent authorization configuration, so that the client proxies can automatically inject
the authorization tokens that the server can properly identify and use to enforce permission validations.


## Design notes
The server-side implementation of the authorization functionality is defined [here](./../../../sdk/python/feast/permissions/server).
Few of the key models, classes to understand the authorization implementation on the client side can be found [here](./../../../sdk/python/feast/permissions/client).

## Configuring Authorization
The authorization is configured using a dedicated `auth` section in the `feature_store.yaml` configuration.

**Note**: As a consequence, when deploying the Feast servers with the Helm [charts](../../../infra/charts/feast-feature-server/README.md),
the `feature_store_yaml_base64` value must include the `auth` section to specify the authorization configuration.

### No Authorization
This configuration applies the default `no_auth` authorization:
```yaml
project: my-project
auth:
type: no_auth
...
```

### OIDC Authorization
With OIDC authorization, the Feast client proxies retrieve the JWT token from an OIDC server (or [Identity Provider](https://openid.net/developers/how-connect-works/))
and append it in every request to a Feast server, using an [Authorization Bearer Token](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#bearer).

The server, in turn, uses the same OIDC server to validate the token and extract the user roles from the token itself.

Some assumptions are made in the OIDC server configuration:
* The OIDC token refers to a client with roles matching the RBAC roles of the configured `Permission`s (*)
* The roles are exposed in the access token passed to the server

(*) Please note that **the role match is case-sensitive**, e.g. the name of the role in the OIDC server and in the `Permission` configuration
must be exactly the same.

For example, the access token for a client `app` of a user with `reader` role should have the following `resource_access` section:
```json
{
"resource_access": {
"app": {
"roles": [
"reader"
]
},
}
```

An example of OIDC authorization configuration is the following:
```yaml
project: my-project
auth:
type: oidc
client_id: _CLIENT_ID__
client_secret: _CLIENT_SECRET__
realm: _REALM__
auth_server_url: _OIDC_SERVER_URL_
auth_discovery_url: _OIDC_SERVER_URL_/realms/master/.well-known/openid-configuration
...
```

In case of client configuration, the following settings must be added to specify the current user:
```yaml
auth:
...
username: _USERNAME_
password: _PASSWORD_
```

### Kubernetes RBAC Authorization
With Kubernetes RBAC Authorization, the client uses the service account token as the authorizarion bearer token, and the
server fetches the associated roles from the Kubernetes RBAC resources.

An example of Kubernetes RBAC authorization configuration is the following:
{% hint style="info" %}
**NOTE**: This configuration will only work if you deploy feast on Openshift or a Kubernetes platform.
{% endhint %}
```yaml
project: my-project
auth:
type: kubernetes
...
```

In case the client cannot run on the same cluster as the servers, the client token can be injected using the `LOCAL_K8S_TOKEN`
environment variable on the client side. The value must refer to the token of a service account created on the servers cluster
and linked to the desired RBAC roles.
1 change: 1 addition & 0 deletions docs/getting-started/components/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ A complete Feast deployment contains the following components:
* **Batch Materialization Engine:** The [Batch Materialization Engine](batch-materialization-engine.md) component launches a process which loads data into the online store from the offline store. By default, Feast uses a local in-process engine implementation to materialize data. However, additional infrastructure can be used for a more scalable materialization process.
* **Online Store:** The online store is a database that stores only the latest feature values for each entity. The online store is either populated through materialization jobs or through [stream ingestion](../../reference/data-sources/push.md).
* **Offline Store:** The offline store persists batch data that has been ingested into Feast. This data is used for producing training datasets. For feature retrieval and materialization, Feast does not manage the offline store directly, but runs queries against it. However, offline stores can be configured to support writes if Feast configures logging functionality of served features.
* **Authorization manager**: The authorization manager detects authentication tokens from client requests to Feast servers and uses this information to enforce permission policies on the requested services.
Copy link
Member

@franciscojavierarceo franciscojavierarceo Aug 20, 2024

Choose a reason for hiding this comment

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

Can we add a section called architecture/rbac.md to give a high-level overview of what this aims to do?

Copy link
Contributor

Choose a reason for hiding this comment

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

Added doc under architecture/rbac.md Please take a look

Choose a reason for hiding this comment

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

Thank you!

4 changes: 4 additions & 0 deletions docs/getting-started/concepts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@
{% content-ref url="dataset.md" %}
[dataset.md](dataset.md)
{% endcontent-ref %}

{% content-ref url="permission.md" %}
[permission.md](permission.md)
{% endcontent-ref %}
112 changes: 112 additions & 0 deletions docs/getting-started/concepts/permission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Permission

## Overview

The Feast permissions model allows to configure granular permission policies to all the resources defined in a feature store.

The configured permissions are stored in the Feast registry and accessible through the CLI and the registry APIs.

The 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)

Note that there is no permission enforcement when accessing the Feast API with a local provider.

## Concepts

The permission model is based on the following components:
- A `resource` is a Feast object that we want to secure against unauthorized access.
- We assume that the resource has a `name` attribute and optional dictionary of associated key-value `tags`.
- An `action` is a logical operation executed on the secured resource, like:
- `create`: Create an instance.
- `describe`: Access the instance state.
- `update`: Update the instance state.
- `delete`: Delete an instance.
- `read`: Read both online and offline stores.
- `read_online`: Read the online store.
- `read_offline`: Read the offline store.
- `write`: Write on any store.
- `write_online`: Write to the online store.
- `write_offline`: Write to the offline store.
- A `policy` identifies the rule for enforcing authorization decisions on secured resources, based on the current user.
- A default implementation is provided for role-based policies, using the user roles to grant or deny access to the requested actions
on the secured resources.

The `Permission` class identifies a single permission configured on the feature store and is identified by these attributes:
- `name`: The permission name.
- `types`: The list of protected resource types. Defaults to all managed types, e.g. the `ALL_RESOURCE_TYPES` alias. All sub-classes are included in the resource match.
- `name_pattern`: A regex to match the resource name. Defaults to `None`, meaning that no name filtering is applied
- `required_tags`: Dictionary of key-value pairs that must match the resource tags. Defaults to `None`, meaning that no tags filtering is applied.
- `actions`: The actions authorized by this permission. Defaults to `ALL_VALUES`, an alias defined in the `action` module.
- `policy`: The policy to be applied to validate a client request.

To simplify configuration, several constants are defined to streamline the permissions setup:
- In module `feast.feast_object`:
- `ALL_RESOURCE_TYPES` is the list of all the `FeastObject` types.
- `ALL_FEATURE_VIEW_TYPES` is the list of all the feature view types, including those not inheriting from `FeatureView` type like
`OnDemandFeatureView`.
- In module `feast.permissions.action`:
- `ALL_ACTIONS` is the list of all managed actions.
- `READ` includes all the read actions for online and offline store.
- `WRITE` includes all the write actions for online and offline store.
- `CRUD` includes all the state management actions to create, describe, update or delete a Feast resource.

Given the above definitions, the feature store can be configured with granular control over each resource, enabling partitioned access by
teams to meet organizational requirements for service and data sharing, and protection of sensitive information.

The `feast` CLI includes a new `permissions` command to list the registered permissions, with options to identify the matching resources for each configured permission and the existing resources that are not covered by any permission.

{% hint style="info" %}
**Note**: Feast resources that do not match any of the configured permissions are not secured by any authorization policy, meaning any user can execute any action on such resources.
{% endhint %}

## Definition examples
This permission definition grants access to the resource state and the ability to read all of the stores for any feature view or
feature service to all users with the role `super-reader`:
```py
Permission(
name="feature-reader",
types=[FeatureView, FeatureService],
tokoko marked this conversation as resolved.
Show resolved Hide resolved
policy=RoleBasedPolicy(roles=["super-reader"]),
actions=[AuthzedAction.DESCRIBE, READ],
)
```

This example grants permission to write on all the data sources with `risk_level` tag set to `high` only to users with role `admin` or `data_team`:
```py
Permission(
name="ds-writer",
types=[DataSource],
required_tags={"risk_level": "high"},
policy=RoleBasedPolicy(roles=["admin", "data_team"]),
actions=[AuthzedAction.WRITE],
)
```

{% hint style="info" %}
**Note**: When using multiple roles in a role-based policy, the user must be granted at least one of the specified roles.
{% endhint %}


The following permission grants authorization to read the offline store of all the feature views including `risky` in the name, to users with role `trusted`:

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

## Authorization configuration
In order to leverage the permission functionality, the `auth` section is needed in the `feature_store.yaml` configuration.
Currently, Feast supports OIDC and Kubernetes RBAC authorization protocols.

The default configuration, if you don't specify the `auth` configuration section, is `no_auth`, indicating that no permission
enforcement is applied.

The `auth` section includes a `type` field specifying the actual authorization protocol, and protocol-specific fields that
are specified in [Authorization Manager](../components/authz_manager.md).
Loading
Loading