Skip to content

Feature/openfga integration - #1

Merged
threehook merged 1 commit into
masterfrom
feature/openfga-integration
Aug 9, 2026
Merged

Feature/openfga integration#1
threehook merged 1 commit into
masterfrom
feature/openfga-integration

Conversation

@threehook

Copy link
Copy Markdown
Owner

Summary

Adds OpenFGA as a supported policy store backend, originally contributed via permitio#673 (daveads/opal), plus fixes needed to make it actually work end-to-end:

  • New OPENFGA policy store: OpenFGAClient (opal-client) syncs policy/data updates to an OpenFGA server, same as the existing OPA/Cedar backends.
  • Inline OpenFGA support: client-openfga Docker image runs an embedded OpenFGA server, following the same pattern as inline OPA/Cedar.
  • App tests: app-tests/openfga-test.py exercises permission checks, relationship reads, and authorization-model validation against a live OpenFGA instance.

Fixes on top of the original merge

  • client-openfga's Docker CMD was overridden to run only supervisord, so the opal-client process itself never started — only the OpenFGA server did. Replaced with scripts/start-openfga.sh, which starts OpenFGA, waits for it to be healthy, and then execs the normal start.sh.
  • Removed a hardcoded OpenFGA store ID (Makefile, both example/test docker-compose files) that only ever existed in the original author's own OpenFGA instance. The store is now auto-created on startup when OPAL_OPENFGA_STORE_ID isn't set, so make docker-run-client-openfga and the app-tests work out of the box.
  • app-tests now discover the auto-created store id at runtime instead of assuming a fixed one, so each test run is isolated.
  • Fixed openfga-app-test.yml's trigger (branches: [ test ] → [ master ]) — it previously could never run in CI.
  • Restored functools import and implemented OpenFGARunner.health_check(), both dropped/missing from the original merge once master had moved on (crashed on boot with "Can't instantiate abstract class OpenFGARunner").

Test plan

  • app-tests/openfga-test.py passes locally via app-tests/run-openfga-services.sh (17/17 cases)
  • make docker-build-client-openfga && make docker-run-client-openfga boots opal-client (not just OpenFGA) and auto-creates a store

@threehook
threehook force-pushed the feature/openfga-integration branch 5 times, most recently from 2e217a8 to 052d127 Compare August 9, 2026 11:14
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.
@threehook
threehook force-pushed the feature/openfga-integration branch from 052d127 to 21a3cc5 Compare August 9, 2026 11:51
@threehook
threehook merged commit f79aca4 into master Aug 9, 2026
9 checks passed
@threehook
threehook deleted the feature/openfga-integration branch August 10, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant