Hi, could you explain how the hybrid control / dat...
# general
m
Hi, could you explain how the hybrid control / data plane approach works? How do I configure it? How do I point to the database in my infrastructure? @Ask Inkeep
a
Thanks for tagging me @Michał Wójcik. I'll look through relevant sources and get back to you shortly.
The hybrid control/data plane approach in Permit.io allows you to use the SaaS service without exposing any data to the cloud (1) . How It Works The architecture splits authorization into two parts : • ​*Control plane*​: Manages relations between entities (user ids, role ids, etc.) and is kept in the cloud • ​*Data plane*​: Contains actual data about entities (names, emails, attributes) and can be kept completely within your network/cloud This decoupling means your deployed services sync with authorization meta-data from the cloud, operating exclusively on unique IDs without being aware of your actual information . While you can optionally store information like user names in the system, it's completely optional . Key Component: Local PDP The main component enabling this hybrid architecture is the Local PDP (Policy Decision Point) . This network node answers authorization queries using policies and contextual data . The Permit.io PDP bundles together OPA, OPAL, and an API server, and is available from Docker hub . It can be deployed as a sidecar, cluster, or single instance for light workloads . Configuration Methods There are three ways to load data into your PDPs (2) : 1. ​*Loading to Permit as a database*​ - Store attributes per object in the UI or API 2. ​*Loading data as part of the input*​ - Pass data directly in authorization queries 3. ​*Loading data asynchronously from data sources via OPAL*​ For connecting to your own data sources, you can use the OPAL Scope Config API . This allows you to set your own data sources to be fetched and loaded into your PDPs using OPAL, enabling you to use data without sharing it with Permit's control plane . To configure external data sources, use the OPAL Scope API by including your project and environment IDs in the API endpoint URL .
To learn more, see the sources I considered: [[1] Control plane / Data plane](https://docs.permit.io/concepts/control-plane-and-data-plane) [[2] Load Custom Data](https://docs.permit.io/how-to/manage-data/loading-data)
a
Hey @Michał Wójcik Thanks for reaching out, does the AI’s answer make sense?
m
OK, so 'hybrid' means that I can upload data directly through the OPAL API use one of the data fetchers from the OPAL docs https://docs.opal.ac/fetch-providers/ Then, in ABAC/Rego, I can use this data like that
Copy code
data.countries[0].capital == "Bridgetown"
@Alon Boshi am I right?
💯 1
a
Let’s let the AI expand on it. @Ask Inkeep
a
Thanks for tagging me @Alon Boshi. I'll look through relevant sources and get back to you shortly.
Yes @Michał Wójcik, you're correct! Let me expand on how this works: ​*Using External Data Sources*​ You can configure custom data sources using the Permit API to be fetched and loaded into your PDPs via OPAL (1) . This allows you to use data without sharing it with Permit's control plane . Here's how to configure it :
Copy code
curl --location --request PUT 'https://api.permit.io/v2/projects/{project_id}/{env_id}/opal_scope' \  
  
--header 'Content-Type: application/json' \  
  
--header 'Accept: application/json' \  
  
--header 'Authorization: Bearer permit_key_***' \  
  
--data '{  
  
 "data": {  
  
 "entries": [  
  
 {  
  
 "url": "https://restcountries.com/v3.1/all?fields=name,region",  
  
 "dst_path": "/countries",  
  
 "config": {  
  
 "headers": {  
  
 "Accept": "application/json"  
  
 }  
  
 }  
  
 }  
  
 ]  
  
 }  
  
}'
The
dst_path
attribute specifies where in the JSON the fetched data will be stored . ​*Using the Data in Policies*​ Once loaded, you can reference this data in your Rego policies exactly as you mentioned :
Copy code
data.countries[0].capital == "Bridgetown"
You can also define custom attributes in your Rego policies by adding code in the
custom
directory of your GitOps repo :
Copy code
package permit.custom  
import future.keywords.in  
  
region_by_common_name[name] := region {  
 some _,country in data.countries  
 name := country.name.common  

 region := country.region  
}  
  
custom_user_attributes["region"] := region_by_common_name[data.users[input.user.key].attributes.country]
​*Important Requirements*​ Make sure your PDP supports custom scopes (v0.2.15+) and enable the
OPAL_SPLIT_ROOT_DATA
flag :
Copy code
docker run -e PDP_API_KEY=<YOUR-PERMIT-API-KEY> -e OPAL_SPLIT_ROOT_DATA=1 permitio/pdp-v2:latest
This approach lets you load data from any external source (like Stripe for billing attributes) and use it in your policies without sharing the actual data with Permit's cloud .
To learn more, see the sources I considered: [[1] Use External Data Source](https://docs.permit.io/how-to/manage-data/use-external-data-source)
Thanks for the feedback, glad I was helpful.
t
@Michał Wójcik really hybrid just means
local PDP
+
Permit.io SaaS
. With a local deployment of the PDP, you can configure a data fetcher to pull data into the PDP and the data will no make it to the SaaS, it will stay local.
m
Please correct me if I am wrong. When I configure the data fetcher and the data is local, are we only talking about data that I can use in rego policies? Something like static data, prepared for the purposes of conditions in policies. Data about relationships, resource instances, and users will always be in the permit cloud. Unless I go offline with the entire permit deployment – I've seen such posts on Slack, that's possible. If my reasoning is correct, I am curious about the database in which you store resource instances, relationships and users. Is a graph database? Is your implementation based on Google Zanzibar Paper? I haven't found much about it on the permit.io blog 🙂 @Ask Inkeep try to answer my questions
a
Thanks for tagging me @Michał Wójcik. I'll look through relevant sources and get back to you shortly.
You're mostly correct! Let me clarify based on the documentation: ​*About Local Data via Fetchers*​ Yes, when you configure external data sources through OPAL, this is primarily for data you'll use in Rego/Cedar policies for conditions and attributes (1) . This data stays local in your PDP and doesn't reach Permit's cloud. ​*About Core Authorization Data Storage*​ For storing relationships, resource instances, and users locally (not in Permit cloud) , there's ​*FactDB*​ - an embedded SQLite database within the PDP (2) . FactDB stores authorization data directly in the PDP, handling massive data volumes locally . To enable FactDB :
Copy code
docker run -it -p 7766:7000 \
 --name pdp-online \
 --env PDP_API_KEY=<YOUR_API_KEY> \
 --env PDP_FACTDB_ENABLED=true \
  permitio/pdp-v2:latest
FactDB tables include : •
role_assignments
•
relationship_tuples
•
instances
•
users
•
user_tenant_assoc
​*About the Graph Database & Zanzibar*​ Yes, Permit.io implements Google Zanzibar-style graph database patterns for ReBAC (3) (4) . The Mesa Verde demo explicitly mentions storing transactions "in a Google-Zanzibar-like graph database, along with their relationships with other users and entities" (3) . The Google Drive tutorial demonstrates Zanzibar-style relationship tuples like
(Folder:soc2, parent, File:access-control-policy)
(4) . With FactDB enabled in offline mode, all this graph data can run completely disconnected from Permit cloud (2) .
To learn more, see the sources I considered: [[1] How to configure external data sources](https://docs.opal.ac/tutorials/configure_external_data_sources) [[2] Local Datastore (FactDB)](https://docs.permit.io/concepts/pdp/factdb) [[3] Fintech / Banking Demo Application](https://docs.permit.io/modeling/mesa-verde) [[4] Modeling Google Drive Permissions with ReBAC](https://docs.permit.io/modeling/google-drive)
Thanks for the feedback, glad I was helpful.