|
| 1 | +# Permission |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The Feast permissions model allows to configure granular permission policies to all the resources defined in a feature store. |
| 6 | + |
| 7 | +The configured permissions are stored in the Feast registry and accessible through the CLI and the registry APIs. |
| 8 | + |
| 9 | +The permission authorization enforcement is performed when requests are executed through one of the Feast (Python) servers |
| 10 | +- The online feature server (REST) |
| 11 | +- The offline feature server (Arrow Flight) |
| 12 | +- The registry server (gRPC) |
| 13 | + |
| 14 | +Note that there is no permission enforcement when accessing the Feast API with a local provider. |
| 15 | + |
| 16 | +## Concepts |
| 17 | + |
| 18 | +The permission model is based on the following components: |
| 19 | +- A `resource` is a Feast object that we want to secure against unauthorized access. |
| 20 | + - We assume that the resource has a `name` attribute and optional dictionary of associated key-value `tags`. |
| 21 | +- An `action` is a logical operation executed on the secured resource, like: |
| 22 | + - `create`: Create an instance. |
| 23 | + - `describe`: Access the instance state. |
| 24 | + - `update`: Update the instance state. |
| 25 | + - `delete`: Delete an instance. |
| 26 | + - `read`: Read both online and offline stores. |
| 27 | + - `read_online`: Read the online store. |
| 28 | + - `read_offline`: Read the offline store. |
| 29 | + - `write`: Write on any store. |
| 30 | + - `write_online`: Write to the online store. |
| 31 | + - `write_offline`: Write to the offline store. |
| 32 | +- A `policy` identifies the rule for enforcing authorization decisions on secured resources, based on the current user. |
| 33 | + - A default implementation is provided for role-based policies, using the user roles to grant or deny access to the requested actions |
| 34 | + on the secured resources. |
| 35 | + |
| 36 | +The `Permission` class identifies a single permission configured on the feature store and is identified by these attributes: |
| 37 | +- `name`: The permission name. |
| 38 | +- `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. |
| 39 | +- `name_pattern`: A regex to match the resource name. Defaults to `None`, meaning that no name filtering is applied |
| 40 | +- `required_tags`: Dictionary of key-value pairs that must match the resource tags. Defaults to `None`, meaning that no tags filtering is applied. |
| 41 | +- `actions`: The actions authorized by this permission. Defaults to `ALL_VALUES`, an alias defined in the `action` module. |
| 42 | +- `policy`: The policy to be applied to validate a client request. |
| 43 | + |
| 44 | +To simplify configuration, several constants are defined to streamline the permissions setup: |
| 45 | +- In module `feast.feast_object`: |
| 46 | + - `ALL_RESOURCE_TYPES` is the list of all the `FeastObject` types. |
| 47 | + - `ALL_FEATURE_VIEW_TYPES` is the list of all the feature view types, including those not inheriting from `FeatureView` type like |
| 48 | + `OnDemandFeatureView`. |
| 49 | +- In module `feast.permissions.action`: |
| 50 | + - `ALL_ACTIONS` is the list of all managed actions. |
| 51 | + - `READ` includes all the read actions for online and offline store. |
| 52 | + - `WRITE` includes all the write actions for online and offline store. |
| 53 | + - `CRUD` includes all the state management actions to create, describe, update or delete a Feast resource. |
| 54 | + |
| 55 | +Given the above definitions, the feature store can be configured with granular control over each resource, enabling partitioned access by |
| 56 | +teams to meet organizational requirements for service and data sharing, and protection of sensitive information. |
| 57 | + |
| 58 | +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. |
| 59 | + |
| 60 | +{% hint style="info" %} |
| 61 | +**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. |
| 62 | +{% endhint %} |
| 63 | + |
| 64 | +## Definition examples |
| 65 | +This permission definition grants access to the resource state and the ability to read all of the stores for any feature view or |
| 66 | +feature service to all users with the role `super-reader`: |
| 67 | +```py |
| 68 | +Permission( |
| 69 | + name="feature-reader", |
| 70 | + types=[FeatureView, FeatureService], |
| 71 | + policy=RoleBasedPolicy(roles=["super-reader"]), |
| 72 | + actions=[AuthzedAction.DESCRIBE, READ], |
| 73 | +) |
| 74 | +``` |
| 75 | + |
| 76 | +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`: |
| 77 | +```py |
| 78 | +Permission( |
| 79 | + name="ds-writer", |
| 80 | + types=[DataSource], |
| 81 | + required_tags={"risk_level": "high"}, |
| 82 | + policy=RoleBasedPolicy(roles=["admin", "data_team"]), |
| 83 | + actions=[AuthzedAction.WRITE], |
| 84 | +) |
| 85 | +``` |
| 86 | + |
| 87 | +{% hint style="info" %} |
| 88 | +**Note**: When using multiple roles in a role-based policy, the user must be granted at least one of the specified roles. |
| 89 | +{% endhint %} |
| 90 | + |
| 91 | + |
| 92 | +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`: |
| 93 | + |
| 94 | +```py |
| 95 | +Permission( |
| 96 | + name="reader", |
| 97 | + types=[FeatureView], |
| 98 | + name_pattern=".*risky.*", |
| 99 | + policy=RoleBasedPolicy(roles=["trusted"]), |
| 100 | + actions=[AuthzedAction.READ_OFFLINE], |
| 101 | +) |
| 102 | +``` |
| 103 | + |
| 104 | +## Authorization configuration |
| 105 | +In order to leverage the permission functionality, the `auth` section is needed in the `feature_store.yaml` configuration. |
| 106 | +Currently, Feast supports OIDC and Kubernetes RBAC authorization protocols. |
| 107 | + |
| 108 | +The default configuration, if you don't specify the `auth` configuration section, is `no_auth`, indicating that no permission |
| 109 | +enforcement is applied. |
| 110 | + |
| 111 | +The `auth` section includes a `type` field specifying the actual authorization protocol, and protocol-specific fields that |
| 112 | +are specified in [Authorization Manager](../components/authz_manager.md). |
0 commit comments