Repository navigation
docs(rfc): propose Cedar as an alternate sandbox policy language - #4564
vishwa-raman wants to merge 12 commits into
Conversation
RFC 0020 proposes authoring sandbox policies in Cedar as an alternative to YAML, chosen once per sandbox and enforced by Cedar alone. It is written for authors who use YAML today: what changes, how each YAML construct maps to Cedar with a translation tutorial, the architectural decisions behind the implementation, parity with the YAML engine, risks, alternatives, and the open questions to settle before acceptance. Refs #4411 Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
|
All contributors have signed the DCO ✍️ ✅ |
Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
|
I have read the DCO document and I hereby sign the DCO. |
…estion Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
|
/ok to test 9f80540 |
Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
|
/ok to test fbca5f1 |
Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
|
/ok to test 6b81504 |
Update RFC 0020 for the changes made in response to the pull request review: capability negotiation between clients, gateway, and runtime; staged policies isolated from enforced decisions and the query budget; bounded host selectors and overlap analysis; a sandbox-wide WebSocket budget; Cedar MCP endpoints in endpoint status; and the public skills. Refresh the implementation plan, verification results, parity tally, and risks, and list the proposed pull request split as a decision. Refs #4474 Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
|
/ok to test f57a08f |
Validation now happens at the gateway and in the supervisor; the CLI and SDKs carry the Cedar text without linking the engine. Add a Rollout section covering the cedar feature boundary, Release Dev versus stable builds, feature-derived capability flags, and the promotion criterion, and narrow the mixed-versions risk to development builds. Refs #4474 Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
9eac5b3 to
57e1adb
Compare
|
This pull request has had no activity for 14 days and is now marked stale. |
|
This is a really good idea! |
Describe the implementation as it stands after the refactor: middleware, endpoint settings, and process are policy-message fields set through the API instead of a --middleware file; a CedarPolicy message selects Cedar; supervisor networking depends on engine-neutral runtime contracts with one composition point; parity lives in tests/policy-conformance with recorded expectations; and Cedar is gated by the experimental feature bundle, built only in Release Dev. Record the implementation as the #5005, #5006, and #4991 stack, and update verification and rollout to match. Older gateways that ignore the cedar_policy field, load-time warnings, and a CI check for stable builds follow #5006 as it is today and are listed under Open questions pending review. Refs #4474 Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. rust-sdk — No explicit risk acceptance found
2. rust-sdk — No explicit risk acceptance found
3. api-behavior — No explicit risk acceptance foundStatic credential placeholders previously resolved in arbitrary supported headers, query parameters, and paths, but now require matching placement metadata and otherwise default to
4. policy — No explicit risk acceptance found
5. configuration — No explicit risk acceptance found
6. api-behavior — No explicit risk acceptance foundOCSF records remove top-level
Review details
Advisory review; publication gates are unchanged. |
#5005 and #5006 have merged, so describe Cedar as implemented on main in development builds, with #4565 superseded and the examples from #4991 still to be brought to main. Rename the binary build input from `dev-build` to `experimental` to match the merged workflows, and record that the RPM build maps the `ai-openshell/cedar` git source through deploy/rpm/create-vendor-archive.sh, verified with an offline build of the merged tree. Refs #4474 Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. helm — No explicit risk acceptance foundThe Helm chart now sets enable_gateway_service_routing=false when the value is absent, whereas existing installations enabled gateway service routing.
2. helm — No explicit risk acceptance foundservice.metricsPort values 0 and false previously disabled metrics, but now fail chart validation even with metrics.enabled=false.
Review details
Advisory review; publication gates are unchanged. |
Refs #4474 Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
| A panel review of the pull request found six defects and one documentation | ||
| gap, each since fixed with a regression test: host-glob overlap analysis | ||
| that could allocate memory quadratic in selector length; no capability | ||
| negotiation, so an older gateway read a Cedar policy as empty YAML; a |
There was a problem hiding this comment.
The older-gateway case is still open in the merged implementation. Supervisor capability negotiation protects delivery to the runtime. A gateway that predates cedar_policy can still accept the request as YAML and compose attached-provider grants into the resulting policy. Can we remove this from the fixed list and state the remaining gap in the summary? If submission is meant to fail closed across supported versions, the client needs a gateway capability check
There was a problem hiding this comment.
Agreed; fixed in 0d1594d. The panel paragraph now lists five fixed defects plus the documentation gap. The sixth is described as fixed toward the runtime by supervisor capability negotiation and still open toward gateways released before Cedar support, since clients no longer check gateway support before sending. The Summary now states this gap alongside the global-policy restart case, and both point to Open questions, where the gateway capability check is already asked.
| | `landlock:` section | Set in the policy | No Cedar form; defaults apply | | ||
| | Attached providers | Grant access to their endpoints and supply credentials | Supply credentials only; your policy must allow the endpoints | | ||
| | Gateway-wide configuration applied to every sandbox (`openshell policy set --global`), policy templates | Supported | YAML only | | ||
| | Format of a sandbox | — | Fixed for its lifetime; recreate to switch | |
There was a problem hiding this comment.
Can we define what happens when an existing Cedar sandbox starts again under a global YAML policy? The gateway selects the global policy before the stored sandbox policy. A fresh supervisor then chooses OPA from the delivered payload. The live-reload guard pins the engine for the running supervisor. If the guarantee is for the sandbox's lifetime, the gateway needs to handle this conflict at startup too.
There was a problem hiding this comment.
Confirmed on main: when a global policy is set, build_sandbox_config_snapshot_with_sources serves it without decoding the stored policy, so a restarted Cedar sandbox gets YAML and its new supervisor picks Rego. The live-reload guard only covers a running supervisor. In 0d1594d the table says the format is fixed while its supervisor runs, the global-policy row and the Summary name the restart case, and the global-policy open question now asks whether the gateway should refuse to start a Cedar sandbox under a global YAML policy or deliver its stored Cedar policy, so the format holds for its lifetime. Defining that behaviour is the decision this RFC needs to make.
There was a problem hiding this comment.
The restart caveat is clear now. Can we extend it to first launch? The create path also gives an active global YAML policy precedence over the submitted Cedar policy. The supervisor then selects OPA from the effective payload. Please describe the engine as fixed for each supervisor instance and spell out what should happen on both first launch and restart.
| generation, activate the policy (closing inspected tunnels pinned to the old | ||
| generation), install provider credentials, and publish the middleware. A | ||
| rejected revision leaves all four on the previous revision, and a change to | ||
| middleware alone keeps Cedar's generation so it does not close tunnels. |
There was a problem hiding this comment.
Please distinguish authored middleware edits from registry reconciliation. The runtime test shows that changing authored middleware advances the Cedar generation and invalidates existing tunnels, even when the Cedar source is unchanged. Reconciling the registry with unchanged authored middleware preserves the tunnels.
There was a problem hiding this comment.
You are right, the text had it backwards. middleware_only_reload_advances_the_cedar_generation_and_closes_tunnels shows that an authored middleware change advances the Cedar generation and makes tunnels stale even with unchanged Cedar source, while reconciling the registry with unchanged authored middleware keeps both. Fixed in 0d1594d.
| |---|---|---| | ||
| | Policy file | `.yaml`, `.yml`, or any other extension | `.cedar` (any case) | | ||
| | Create | `openshell sandbox create --policy p.yaml` | `openshell sandbox create --policy p.cedar` | | ||
| | Replace on a live sandbox | `openshell policy set` | `openshell policy set` with the whole policy | |
There was a problem hiding this comment.
Can we qualify the CLI replacement workflow for sandboxes configured through the API? A .cedar file produces a source-only replacement. If the existing policy has an explicit process, the gateway rejects that replacement because the process setting is missing. Please show the API workflow for carrying companion fields forward.
There was a problem hiding this comment.
Added in 0d1594d. policy set sends the whole policy message and a .cedar file carries only the source. So it drops middleware and endpoint settings that were set through the API, and validate_static_fields_unchanged rejects it when the sandbox has process. The new paragraph shows the API workflow: read the policy (policy get <name> --base --output json shows the same fields), replace cedar_policy.source, and send the whole SandboxPolicy through UpdateConfig. The remaining CLI step now includes replacing the Cedar text while keeping those fields.
There was a problem hiding this comment.
The new paragraph explains the whole-policy replacement. Could the table say “sends a source-only replacement” too? For the API workflow, please use GetSandboxPolicyStatus.revision.policy as the input. The CLI's Cedar JSON view omits landlock, and the gateway rejects live updates that drop an explicit Landlock setting. Reading the typed stored policy and changing only cedar_policy.source preserves the companion fields.
| port: 443 | ||
| path: /graphql | ||
| protocol: graphql | ||
| rules: |
There was a problem hiding this comment.
These two policies handle denials differently. The YAML endpoint defaults to audit because it omits enforcement. The Cedar version defaults to enforce because both statements omit @enforcement. Please set enforcement: enforce in the YAML example, or annotate both Cedar statements for audit, so the tutorial preserves behavior.
There was a problem hiding this comment.
Good catch. An omitted enforcement maps to audit (EnforcementSetting::Default becomes EnforcementMode::Audit). 0d1594d sets enforcement: enforce on the YAML GraphQL endpoint. I checked the other tutorial pairs: the TCP endpoint is not inspected, and the Audit mode example omits enforcement on purpose.
| | Gateway-wide configuration applied to every sandbox (`openshell policy set --global`), policy templates | Supported | YAML only | | ||
| | Format of a sandbox | — | Fixed for its lifetime; recreate to switch | | ||
| | Gateway and runtime versions | Any | Development builds of both; a gateway without Cedar support rejects a Cedar policy, the gateway withholds a Cedar policy from a runtime that does not advertise support, and a gateway released before Cedar may ignore it (see [Open questions](#open-questions)) | | ||
| | View the policy | `openshell policy get` | `openshell policy get` prints the Cedar text | |
There was a problem hiding this comment.
Bare openshell policy get <name> returns metadata. Could we show openshell policy get <name> --base for Cedar source and openshell policy get <name> --full --output json for the effective policy with configured middleware and provider credential rules? That also makes the display criterion in #4411 verifiable.
There was a problem hiding this comment.
Updated in 0d1594d. The table now shows policy get <name> --base for the Cedar text and --full --output json for the effective policy, which includes network_middlewares, endpoint_settings, process, and provider_credential_rules. While checking this I also corrected two lines that said the CLI prints load-time warnings: on main the supervisor logs them as OCSF configuration events and clients do not receive them.
Align RFC 0020 with main after the review on #4564: - State in the summary that two gaps remain: gateways released before Cedar support ignore a Cedar policy, and a Cedar sandbox restarted under a gateway-wide YAML policy starts under it. Move the older-gateway case out of the fixed panel findings. - Ask whether the gateway should keep a Cedar sandbox's format across a restart under a global YAML policy. - Say that a middleware change advances Cedar's generation and closes tunnels, while registry reconciliation keeps them. - Explain that a .cedar replacement drops fields set through the API and is rejected when `process` is set, and show the API workflow. - Set `enforcement: enforce` on the YAML GraphQL example so it matches the Cedar version. - Show `policy get --base` and `--full --output json`, and say the supervisor logs load-time warnings rather than the CLI printing them. Refs #4474 Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
| staged policy reads do not count toward the 4,096-combination limit of the | ||
| deciding policies, the comparison has its own budget, and an evaluation error | ||
| or an exceeded budget in the comparison skips it and keeps the enforced | ||
| result (the same error in a deciding policy still fails the request closed): |
There was a problem hiding this comment.
Please qualify “fails the request closed.” The runtime treats an exceeded query budget as a policy denial, and the relay can forward that denial on an audit path. If the budget is intended to block forwarding in both modes, the runtime needs to treat it as a hard rejection.
|
|
||
| This walks through the quickstart policy, which lets `curl` read the GitHub | ||
| REST API, then adds the rule forms the other examples in the repository use. | ||
| Each example and e2e directory with a YAML policy has a Cedar version beside |
There was a problem hiding this comment.
Could this point to the dedicated Cedar E2E suite? The Cedar counterparts and POLICY_FORMAT=cedar switches for the existing examples were in #4991, which closed without merging. The implementation plan already lists bringing those examples to main as remaining work.
| attributes and let a REST permit decide GraphQL requests; a per-tunnel rather | ||
| than sandbox-wide WebSocket budget; staged policies that could change an | ||
| enforced decision through the query budget or an evaluation error; Cedar MCP | ||
| endpoints missing from endpoint status; and public skills that round-tripped |
There was a problem hiding this comment.
Summary
RFC 0020 proposes authoring sandbox policies in Cedar as an alternative to YAML. The format is chosen once per sandbox; YAML sandboxes are unchanged, and a Cedar sandbox is decided by Cedar alone, with no YAML or Rego in its decision path. The motivation is expressiveness that stays analyzable: authors can write conditions the YAML structure never anticipated, and every policy remains open to decidable analysis.
The RFC is written for policy authors who use YAML today. It covers what changes for an author, how each YAML construct maps to Cedar with a translation tutorial, the architectural decisions behind the implementation, parity with the YAML engine, risks, alternatives, and the open questions to settle before acceptance.
Related Issue
Closes #4610
Refs #4474, the parent issue for all policy work, which stays open, and #4411, the originating feature request where maintainers assigned RFC 0020.
Changes
rfc/0020-cedar-policy-engine/README.mdinreviewstate.Implementation
An implementation exists on the feature branch
vishwa/cedar-openshell(one commit onmain). The parity harness there runs 2,909 cases pairing YAML and Cedar policies through both engines; 2,904 agree and the 5 recorded differences are deliberate, with Cedar the stricter side in each. The branch depends on the Cedar team's delimitedlikework (cedar-policy/rfcs#115), carried in the publicai-openshell/cedarrepository and pinned by commit until Cedar releases it.Testing
mise run pre-commit; documentation-only change)Checklist
🤖 Generated with Claude Code