mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-27 02:39:38 +02:00
docs(user): de-dev polish — strip internal scaffolding from user docs (Phase 3a) (#226)
Remove developer-only scaffolding that leaked into the public user/operator docs, while preserving every user-facing behavior, command, flag, endpoint, constant, and env var. No behavior changes. Removed across 18 files: - internal ticket / sequencing refs (MR-NNN, RFC-NNN, "Phase N"); - source-code paths (crates/**/*.rs, *.pest) and internal struct/function dumps (e.g. the QueryIR / GraphCommit / SchemaMigrationPlan Rust types, internal fn names like fork_branch_from_state, optimize_all_tables); - Lance-internal blocker prose (upstream issue numbers, blob-decode cause, sidecar Phase-B/C mechanics) — keeping the user-visible behavior (e.g. "optimize skips Blob-column tables; reads/writes unaffected"); - pre-v0.4.0 Run-state-machine archaeology. Internal IR/lowering/recovery-internals sections were either trimmed to a brief user-facing note (e.g. "Traversal execution", "interrupted writes recover automatically; recovery commits are recorded under actor omnigraph:recovery") or removed. Kept: all language syntax, lint codes, Cedar actions/scopes, endpoints, error taxonomy, every constant and env var (verified none dropped from the constants cheat-sheet), and the operator-facing explanations of on-disk artifacts. Residual "legacy" mentions are all user-facing (the deprecated omnigraph.yaml, the legacy token chain, old command names). Verified: zero internal-scaffolding leaks (MR/RFC/Phase/.rs/.pest = 0) across docs/user; zero broken links; check-agents-md.sh green. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
612741b387
commit
77dffdae92
18 changed files with 192 additions and 266 deletions
|
|
@ -13,7 +13,7 @@ Per-graph actions (bind to `Omnigraph::Graph::"<graph_id>"`):
|
|||
5. `branch_create`
|
||||
6. `branch_delete`
|
||||
7. `branch_merge`
|
||||
8. `admin` — reserved for policy-management surfaces (hot reload, audit log, approvals). No call site today; see MR-724 for the reservation rationale.
|
||||
8. `admin` — reserved for policy-management surfaces (hot reload, audit log, approvals). No call site today.
|
||||
9. `invoke_query` — gates invoking a server-side stored query (the `queries:` registry). Graph-scoped (like `admin`) — per-branch access is enforced by the inner `read` / `change` gate, so a rule that sets `branch_scope` on `invoke_query` is rejected. Coarse in this release: an `invoke_query` allow rule permits any stored query on the graph; a future, additive refinement adds an optional per-query-name scope without changing rules written against the coarse action. Enforced at `POST /queries/{name}` (see [server](server.md)). A stored *mutation* is double-gated: `invoke_query` to reach the tool, plus `change` for the write itself (the engine `_as` writers still enforce per the query body).
|
||||
|
||||
Server-scoped action (v0.6.0+; binds to `Omnigraph::Server::"root"`):
|
||||
|
|
@ -113,20 +113,20 @@ Policy is a property of the **engine**, not the transport. Every mutating
|
|||
write — `mutate_as`, `load_as` (the deprecated `ingest_as` shims route
|
||||
through it), `apply_schema_as`,
|
||||
`branch_create_as`, `branch_create_from_as`, `branch_delete_as`,
|
||||
`branch_merge_as` — calls `Omnigraph::enforce(action, scope, actor)` at
|
||||
the head of the method. The gate fires identically whether the call
|
||||
`branch_merge_as` — consults the policy gate at the head of the method.
|
||||
The gate fires identically whether the call
|
||||
originates from the HTTP server, the CLI, or an embedded SDK consumer.
|
||||
When no `PolicyChecker` is installed (the dev/embedded default) the gate
|
||||
When no policy is installed (the dev/embedded default) the gate
|
||||
is a strict no-op; when one is installed and the call site forgets to
|
||||
thread an actor through, the gate fails closed rather than silently
|
||||
bypassing.
|
||||
|
||||
## Server runtime states (MR-723)
|
||||
## Server runtime states
|
||||
|
||||
The HTTP server classifies its startup configuration into one of three
|
||||
states based on whether bearer tokens are configured and whether a
|
||||
policy file is set. The state determines what happens to a request that
|
||||
reaches `authorize_request()` without a matching policy permit.
|
||||
reaches the authorization gate without a matching policy permit.
|
||||
|
||||
| State | Tokens | Policy file | Behavior |
|
||||
|---|---|---|---|
|
||||
|
|
@ -134,21 +134,17 @@ reaches `authorize_request()` without a matching policy permit.
|
|||
| **DefaultDeny** | yes | no | Every authenticated request for an action other than `read` is rejected with HTTP 403. Closes the "tokens but forgot the policy file" trap — an operator who sets up auth and forgot to point at a policy file used to ship the illusion of protection. |
|
||||
| **PolicyEnabled** | yes | yes | Authenticated requests that reach a configured policy engine are evaluated by Cedar. Server-scoped actions still require `server.policy.file`. |
|
||||
|
||||
The classifier is `classify_server_runtime_state` in
|
||||
`crates/omnigraph-server/src/lib.rs`; it returns `Err` for the "no
|
||||
tokens, no policy, no flag" cell and for "policy file, no tokens" so the
|
||||
server refuses to start instead of silently shipping an open instance or
|
||||
a policy-protected server that can only 401. Tests pin every cell of the
|
||||
matrix and the State-2 deny path.
|
||||
The server refuses to start for the "no tokens, no policy, no flag" cell
|
||||
and for "policy file, no tokens" — instead of silently shipping an open
|
||||
instance or a policy-protected server that can only 401.
|
||||
|
||||
Server-side, `authorize_request()` still runs at the HTTP boundary —
|
||||
Server-side, request authorization still runs at the HTTP boundary —
|
||||
that's where actor identity is resolved from the bearer token and where
|
||||
admission control / per-actor rate limits live. Engine-layer enforcement
|
||||
is the **defense in depth** layer: it catches CLI direct-engine writes,
|
||||
embedded SDK consumers, and any future transport that hasn't (or won't)
|
||||
re-implement HTTP's authorize_request. Both layers consult the same
|
||||
Cedar policy via the same `PolicyChecker` trait, so decisions cannot
|
||||
disagree.
|
||||
re-implement the HTTP boundary's authorization. Both layers consult the same
|
||||
Cedar policy, so decisions cannot disagree.
|
||||
|
||||
## Coarse vs. fine enforcement
|
||||
|
||||
|
|
@ -157,19 +153,19 @@ responsibilities:
|
|||
|
||||
| Layer | Question it answers | Where it fires |
|
||||
|---|---|---|
|
||||
| **Engine-layer (coarse)** | Can this actor invoke this action against this branch / branch-transition? | `Omnigraph::enforce(action, scope, actor)` at the head of every `_as` writer; one Cedar decision per call. |
|
||||
| **Query-layer (fine)** | For the rows / types this action actually touches, which can the actor see or modify? | Per-row predicates pushed into DataFusion at plan time. **Not yet implemented — see MR-725.** |
|
||||
| **Engine-layer (coarse)** | Can this actor invoke this action against this branch / branch-transition? | The policy gate at the head of every `_as` writer; one Cedar decision per call. |
|
||||
| **Query-layer (fine)** | For the rows / types this action actually touches, which can the actor see or modify? | Per-row predicates pushed into the query plan. **Not yet implemented.** |
|
||||
|
||||
The engine-layer gate keeps `ResourceScope` deliberately at branch
|
||||
granularity (`Graph`, `Branch`, `TargetBranch`, `BranchTransition`).
|
||||
The engine-layer gate keeps its resource scope deliberately at branch
|
||||
granularity (graph, branch, target branch, branch transition).
|
||||
Per-type and per-row authority is the query-layer's job; conflating them
|
||||
in `ResourceScope` would create two places per-type policy could be
|
||||
in the engine-layer scope would create two places per-type policy could be
|
||||
evaluated and a drift surface between them.
|
||||
|
||||
## Actor identity (signed-claim-only)
|
||||
|
||||
The actor identity used for every policy decision comes from the matched bearer token — never from a client-supplied request header, query parameter, or body field. The server resolves the token at the auth middleware boundary, looks up the actor it was minted for, and overwrites whatever the handler may have placed in the policy request. Clients cannot set `actor_id` directly.
|
||||
|
||||
This is intentional. Trusting client-supplied identity for authorization is "asking the attacker if they're an admin" — Supabase's RLS history names the same footgun. The chokepoint lives in `authorize_request` in `crates/omnigraph-server/src/lib.rs` and is named in `docs/dev/invariants.md` Hard Invariant 11. A regression test asserts the contract: a request with `Authorization: Bearer <token-for-actor-A>` plus `X-Actor-Id: actor-B` always evaluates as actor A, never as actor B.
|
||||
This is intentional. Trusting client-supplied identity for authorization is "asking the attacker if they're an admin" — Supabase's RLS history names the same footgun. The chokepoint lives at the server's auth boundary: a request with `Authorization: Bearer <token-for-actor-A>` plus `X-Actor-Id: actor-B` always evaluates as actor A, never as actor B.
|
||||
|
||||
If you find yourself wanting to let clients override `actor_id` for impersonation, delegation, or service-account flows — that's a feature, but it needs explicit design (e.g., signed delegation claims, an `On-Behalf-Of` audit trail). It is not a convenience knob.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue