Skip to content

[epic] OPA policy engine — embedded authorization with admin policy editor #272

Closed

Description

@Quick104

Goal

Embed Open Policy Agent (github.com/open-policy-agent/opa/v1/rego) as Silo's authorization engine. Vendor-authored Rego reproduces today's viewer-scope resolution, admin/permission gates, and download/playback action decisions exactly (proven by dual-execution parity tests); admins get a full policy editor (validate / simulate / immutable versioning / rollback) for narrowing-only custom overrides; every decision feeds a partitioned audit log.

Design docs (committed on the implementation branch)

  • Spec: docs/superpowers/specs/2026-07-02-opa-policy-engine-design.md
  • Plan: docs/superpowers/plans/2026-07-02-opa-policy-engine.md

Locked decisions

  • Embedded Go library, no sidecar (~+19 MB binary, ~14 µs/eval measured).
  • Full admin policy editor UI (dedicated /admin/policy page, CodeMirror 6).
  • v1 surfaces: viewer Scope resolution (all five access.NewResolver sites incl. jellycompat + ABS), acting-admin/permission gates, download/playback actions.
  • Vendor Rego via go:embed; admin overrides in silo_custom.<domain> namespace via a narrowing-only override(base_decision, input) contract.
  • Sandbox: ast.Capabilities lockdown, 25 ms eval timeout, compile-check before persist.
  • Decision log: partitioned policy_decisions (partman daily), sampling + verbosity, denials always logged.
  • Direct replacement (no shadow mode); parity gated by tests; legacy Go retained one release then deleted (follow-up).

Delivery

Implemented end-to-end in a single PR (phases 1–9 of the plan as individual commits). Phase 10 (legacy deletion after bake) is a follow-up PR.

Deferred (documented in spec)

Compile-to-SQL list filtering, plugin route gating, widening (grant) overrides, persisted policy test suites.

Activity

  1. added 20 commits that reference this issue on Jul 2, 2026
  2. Quick104 commented on Sep 4, 2026

    @Quick104
    ContributorAuthor

    Fixed on main by #282.

    The embedded OPA engine, narrowing-only custom overrides, admin validate/simulate/version/rollback workspace, capability endpoint, and decision audit log have landed.

    Verified the policy implementation and admin surface on current main. The merged PR records dual-execution parity tests and live policy activation/simulation. Legacy deletion and the other explicitly deferred capabilities remain follow-up work as specified in this issue.

    Closing as completed after checking current main (a4c8f4b2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions