OpenFGA Integration - #673
Conversation
✅ Deploy Preview for opal-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
OpenFGA OPAL Integration Project ChecklistWeek 1: Setup and Core ImplementationDays 1-2: Project Setup and Research
Days 3-5: Core Implementation
Week 2: Feature Completion and Demo PreparationDays 1-3: Feature Implementation
Days 4-5: Demo Preparation
Key Milestones:
|
|
Updates :: Integration into Opal has already begun but is currently on hold. I'm working on the components in isolation from Opal, using the OpenFGA SDK first. |
|
I've completed the isolation test and also simulated integration with OPAL in isolation. At some point, I had to mix the Python SDK with the raw API, but I'll likely find a fix for that later. The test that involved missing the Python SDK and accessing via the raw API and stimulating opal integration was successful. Going start core implementation asap |
recording.mp4 |
|
@garnerp just push that to show what have been working on locally.... to show my current progress... |
|
@daveads I bet you meant to tag me. Any updates on this? |
oh oh... yea i meant to tag... lol still on it... will give you an update on it soon |
|
currently having issues with the config... buh i should fix it soon. |
|
Demo ready... just fixing bugs... opening pr for now... |
|
Based on my discussion with @gemanor, Decided to drop the use of openfga_sdk and use API calls instead, similar to the OPA implementation. |
review.mp4 |
|
any updates on this? |
- client.py: restore `import functools`, dropped by a master-side cleanup that the PR permitio#673 merge didn't re-add, even though the merged-in rehydration-callback setup (shared across OPA/Cedar/OpenFGA) calls functools.partial. - engine/runner.py: implement the abstract health_check() on OpenFGARunner. Master added health_check() as an abstract method on PolicyEngineRunner after PR permitio#673 was opened, so OpaRunner/CedarRunner got updated but OpenFGARunner never did — the client crashed on boot with "Can't instantiate abstract class OpenFGARunner". Verified via app-tests/docker-compose-app-tests-openfga.yml: opal server + client-openfga now boot, sync policy/data to OpenFGA, and all 17 cases in app-tests/openfga-test.py pass.
- client.py: restore `import functools`, dropped by a master-side cleanup that the PR permitio#673 merge didn't re-add, even though the merged-in rehydration-callback setup (shared across OPA/Cedar/OpenFGA) calls functools.partial. - engine/runner.py: implement the abstract health_check() on OpenFGARunner. Master added health_check() as an abstract method on PolicyEngineRunner after PR permitio#673 was opened, so OpaRunner/CedarRunner got updated but OpenFGARunner never did — the client crashed on boot with "Can't instantiate abstract class OpenFGARunner". Verified via app-tests/docker-compose-app-tests-openfga.yml: opal server + client-openfga now boot, sync policy/data to OpenFGA, and all 17 cases in app-tests/openfga-test.py pass.
- client.py: restore `import functools`, dropped by a master-side cleanup that the PR permitio#673 merge didn't re-add, even though the merged-in rehydration-callback setup (shared across OPA/Cedar/OpenFGA) calls functools.partial. - engine/runner.py: implement the abstract health_check() on OpenFGARunner. Master added health_check() as an abstract method on PolicyEngineRunner after PR permitio#673 was opened, so OpaRunner/CedarRunner got updated but OpenFGARunner never did — the client crashed on boot with "Can't instantiate abstract class OpenFGARunner". Verified via app-tests/docker-compose-app-tests-openfga.yml: opal server + client-openfga now boot, sync policy/data to OpenFGA, and all 17 cases in app-tests/openfga-test.py pass.
- client.py: restore `import functools`, dropped by a master-side cleanup that the PR permitio#673 merge didn't re-add, even though the merged-in rehydration-callback setup (shared across OPA/Cedar/OpenFGA) calls functools.partial. - engine/runner.py: implement the abstract health_check() on OpenFGARunner. Master added health_check() as an abstract method on PolicyEngineRunner after PR permitio#673 was opened, so OpaRunner/CedarRunner got updated but OpenFGARunner never did — the client crashed on boot with "Can't instantiate abstract class OpenFGARunner". Verified via app-tests/docker-compose-app-tests-openfga.yml: opal server + client-openfga now boot, sync policy/data to OpenFGA, and all 17 cases in app-tests/openfga-test.py pass.
- client.py: restore `import functools`, dropped by a master-side cleanup that the PR permitio#673 merge didn't re-add, even though the merged-in rehydration-callback setup (shared across OPA/Cedar/OpenFGA) calls functools.partial. - engine/runner.py: implement the abstract health_check() on OpenFGARunner. Master added health_check() as an abstract method on PolicyEngineRunner after PR permitio#673 was opened, so OpaRunner/CedarRunner got updated but OpenFGARunner never did — the client crashed on boot with "Can't instantiate abstract class OpenFGARunner". Verified via app-tests/docker-compose-app-tests-openfga.yml: opal server + client-openfga now boot, sync policy/data to OpenFGA, and all 17 cases in app-tests/openfga-test.py pass.
- client.py: restore `import functools`, dropped by a master-side cleanup that the PR permitio#673 merge didn't re-add, even though the merged-in rehydration-callback setup (shared across OPA/Cedar/OpenFGA) calls functools.partial. - engine/runner.py: implement the abstract health_check() on OpenFGARunner. Master added health_check() as an abstract method on PolicyEngineRunner after PR permitio#673 was opened, so OpaRunner/CedarRunner got updated but OpenFGARunner never did — the client crashed on boot with "Can't instantiate abstract class OpenFGARunner". Verified via app-tests/docker-compose-app-tests-openfga.yml: opal server + client-openfga now boot, sync policy/data to OpenFGA, and all 17 cases in app-tests/openfga-test.py pass.
- client.py: restore `import functools`, dropped by a master-side cleanup that the PR permitio#673 merge didn't re-add, even though the merged-in rehydration-callback setup (shared across OPA/Cedar/OpenFGA) calls functools.partial. - engine/runner.py: implement the abstract health_check() on OpenFGARunner. Master added health_check() as an abstract method on PolicyEngineRunner after PR permitio#673 was opened, so OpaRunner/CedarRunner got updated but OpenFGARunner never did — the client crashed on boot with "Can't instantiate abstract class OpenFGARunner". Verified via app-tests/docker-compose-app-tests-openfga.yml: opal server + client-openfga now boot, sync policy/data to OpenFGA, and all 17 cases in app-tests/openfga-test.py pass.
Adds OpenFGA as a supported policy store backend (originally contributed via permitio#673 from daveads/opal), with fixes to make it actually work end-to-end: - New OPENFGA policy store: OpenFGAClient (opal-client) syncs policy and data updates to an OpenFGA server, following the same pattern as the existing OPA/Cedar backends. - Inline OpenFGA support: the client-openfga Docker image runs an embedded OpenFGA server via scripts/start-openfga.sh, which starts OpenFGA, waits for it to be healthy, and auto-creates a store when OPAL_OPENFGA_STORE_ID isn't set (replacing a broken supervisord-based CMD override that never actually started the opal-client process, and a hardcoded store id that only existed in the original author's own OpenFGA instance). - App tests: app-tests/openfga-test.py exercises permission checks, relationship reads, and authorization-model validation against a live OpenFGA instance. app-tests/run-openfga-services.sh now builds both the client-openfga and server images from source (permitio/opal-client-openfga isn't published anywhere, and opal-server needs this branch's changes - pulling the published image would silently run unpatched upstream code), waits for opal-client's /ready endpoint instead of a fixed sleep, and discovers the auto-created store id at runtime instead of assuming a fixed one. - opal_server's default all-data route now searches the policy repo clone for a data file (data.json by default) instead of always returning {}, with a short bounded retry to cover the repo clone still being in progress on first request. - OpenFGAClient.set_policy_data treats an empty {} data payload as zero tuples (a valid state) instead of raising - relevant when no data source is configured, or briefly during the clone race above. - Fixed openfga-app-test.yml's trigger (branches: [test] -> [master]) so it actually runs in CI. - Restored a dropped `import functools` and implemented the abstract OpenFGARunner.health_check(), both required by changes to master that landed after PR permitio#673 was opened.
Feature: Add OpenFGA Policy Store to OPAL
This PR addresses issue #661 by integrating OpenFGA Policy Store into OPAL.
/claim #661