Skip to content

docs(rfc): propose Cedar as an alternate sandbox policy language - #4564

Open
vishwa-raman wants to merge 12 commits into
mainfrom
docs/4411-cedar-policy-rfc/vishwa-raman
Open

vishwa-raman wants to merge 12 commits into
mainfrom
docs/4411-cedar-policy-rfc/vishwa-raman

Conversation

@vishwa-raman

@vishwa-raman vishwa-raman commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Add rfc/0020-cedar-policy-engine/README.md in review state.

Implementation

An implementation exists on the feature branch vishwa/cedar-openshell (one commit on main). 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 delimited like work (cedar-policy/rfcs#115), carried in the public ai-openshell/cedar repository and pinned by commit until Cedar releases it.

Testing

  • Checks appropriate to the affected code and behavior pass (mise run pre-commit; documentation-only change)
  • Unit tests added/updated (not applicable)
  • E2E tests added/updated (not applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (this PR is the RFC)

🤖 Generated with Claude Code

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>
@copy-pr-bot

copy-pr-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
@vishwa-raman

Copy link
Copy Markdown
Collaborator Author

I have read the DCO document and I hereby sign the DCO.

…estion

Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
@vishwa-raman

Copy link
Copy Markdown
Collaborator Author

/ok to test 9f80540

Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
@vishwa-raman

Copy link
Copy Markdown
Collaborator Author

/ok to test fbca5f1

Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
@vishwa-raman

Copy link
Copy Markdown
Collaborator Author

/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>
@vishwa-raman

Copy link
Copy Markdown
Collaborator Author

/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>
@github-actions

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Nov 11, 2026
@purp purp added area:runtime Sandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle. topic:api Public APIs, gRPC/protobuf, SDK interfaces, versioning, compatibility, and API design standards. topic:architecture System design, component boundaries, data/control flow, architectural decisions, and RFCs. topic:documentation Architecture docs, READMEs, project website updates, and automated documentation generation. topic:policy Policy authoring, validation, proving, distribution, enforcement, ergonomics, and hardening. labels Nov 15, 2026
@github-actions github-actions Bot removed the state:stale Inactive item at risk of automatic closure. label Nov 15, 2026
@nynymike

Copy link
Copy Markdown

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>
@github-actions

Copy link
Copy Markdown

Compatibility review (advisory)

New or updated breaking changes; see the full report for all findings.

1. rust-sdk — No explicit risk acceptance found

raw::proto::open_shell_server::OpenShell gains eight required methods, including get_sandbox_provider_access_token, inline_provider_refresh_secrets, and the secret-management handlers.

  • Impact: Existing downstream mock and server implementations fail to compile with missing trait items, while ordinary client callers remain compatible.
  • Action: Keep new RPCs in separate services or provide source-compatible default methods without changing existing associated types for v0.1.7.
  • PR: docs(rfc): propose Cedar as an alternate sandbox policy language #4564

2. rust-sdk — No explicit risk acceptance found

raw::proto message structs gain fields such as SandboxResponse.application_service_urls and SandboxConfigSnapshot.service_routes, and ProviderCredentialRefreshStrategy gains GithubAppInstallation.

  • Impact: Existing complete message literals, exhaustive destructuring, and exhaustive enum matches fail to compile despite the additive protobuf wire changes.
  • Action: Preserve existing raw data types in v0.1.7 and expose changed shapes separately or defer them to a minor release.
  • PR: docs(rfc): propose Cedar as an alternate sandbox policy language #4564

3. api-behavior — No explicit risk acceptance found

Static credential placeholders previously resolved in arbitrary supported headers, query parameters, and paths, but now require matching placement metadata and otherwise default to Authorization.

  • Impact: Existing imported profiles and workloads using locations such as x-api-key or ?key= receive HTTP 403 credential_placement_mismatch instead of authenticated upstream requests.
  • Action: Preserve existing placeholder placements in v0.1.7 and defer mandatory placement enforcement to a minor release using the documented profile-update migration.
  • PR: docs(rfc): propose Cedar as an alternate sandbox policy language #4564

4. policy — No explicit risk acceptance found

protocol: rest previously relayed allowed WebSocket upgrades, but now rejects every Upgrade request and disallows websocket_credential_rewrite: true.

  • Impact: Existing REST-based WebSocket workloads receive HTTP 403 even in audit mode, and previously valid rewrite policies fail validation.
  • Action: Preserve REST upgrade compatibility in v0.1.7 and defer the documented protocol: websocket migration requirement to a minor release.
  • PR: docs(rfc): propose Cedar as an alternate sandbox policy language #4564

5. configuration — No explicit risk acceptance found

openshell-supervisor --otlp-ocsf-endpoint URL --otlp-ocsf-schema-version 1.3 becomes a versionless invocation, while ocsf_schema_version and TOML schema_version selectors are ignored.

  • Impact: Launchers retaining the supervisor flag fail with an unexpected-argument error, while existing OCSF 1.1/1.3 integrations receive unsupported 1.8.0 records.
  • Action: Retain versioned exports and the supervisor flag in v0.1.7; a minor-release removal also needs actionable conversion guidance for existing collectors.
  • PR: docs(rfc): propose Cedar as an alternate sandbox policy language #4564

6. api-behavior — No explicit risk acceptance found

OCSF records remove top-level container, moving supervisor identity to device.container and gateway sandbox identity to unmapped.sandbox_id and unmapped.sandbox_name.

  • Impact: Existing JSONL and OTLP parsers, SIEM mappings, and correlation queries reading container.uid or container.name lose sandbox attribution even without schema downgrade configured.
  • Action: Preserve the legacy export shape for v0.1.7 and introduce the corrected shape through an opt-in format or a minor release with the documented parser migration.
  • PR: docs(rfc): propose Cedar as an alternate sandbox policy language #4564
Review details
  • Execution: complete
  • Candidate: PR #4564 (aa0f89d2e48ff3d913a6b626d015e545e71cdca7)
  • Baseline: fa2d381eaa9e917fd074b4bc49efea8a2ad3e43e (fa2d381eaa9e917fd074b4bc49efea8a2ad3e43e)
  • Reviewed: rust-sdk, python-sdk, api-behavior, cli, configuration, policy, helm, state

Advisory review; publication gates are unchanged.

Branch check run

#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>
@github-actions

Copy link
Copy Markdown

Compatibility review (advisory)

New or updated breaking changes; see the full report for all findings.

1. helm — No explicit risk acceptance found

The Helm chart now sets enable_gateway_service_routing=false when the value is absent, whereas existing installations enabled gateway service routing.

  • Impact: Upgrading existing Helm values stops publishing gateway service URLs and makes previously working application HTTP and WebSocket requests return 404.
  • Action: Keep enable_gateway_service_routing=true for existing Helm values in v0.1.7 and defer the documented default-change migration to a minor release.
  • PR: docs(rfc): propose Cedar as an alternate sandbox policy language #4564

2. helm — No explicit risk acceptance found

service.metricsPort values 0 and false previously disabled metrics, but now fail chart validation even with metrics.enabled=false.

Review details
  • Execution: complete
  • Candidate: PR #4564 (0f45d19c1f26a11c6c482bbce085377d46c63223)
  • Baseline: fa2d381eaa9e917fd074b4bc49efea8a2ad3e43e (fa2d381eaa9e917fd074b4bc49efea8a2ad3e43e)
  • Reviewed: rust-sdk, python-sdk, api-behavior, cli, configuration, policy, helm, state

Advisory review; publication gates are unchanged.

Branch check run

Refs #4474

Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com>
johnnygreco
johnnygreco previously approved these changes Nov 25, 2026
Comment thread rfc/0020-cedar-policy-engine/README.md Outdated
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread rfc/0020-cedar-policy-engine/README.md Outdated
| `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 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread rfc/0020-cedar-policy-engine/README.md Outdated
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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread rfc/0020-cedar-policy-engine/README.md Outdated
|---|---|---|
| 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 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread rfc/0020-cedar-policy-engine/README.md Outdated
| 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 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the public skill updates to remaining work. The #4565 closure note says the Cedar guidance was left out of #5006, and the current openshell-cli skill still exports the policy to current-policy.yaml and resubmits it as YAML. That workflow does not round-trip a Cedar policy.

This branch has not been deployed

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

Labels

area:runtime Sandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle. rfc topic:api Public APIs, gRPC/protobuf, SDK interfaces, versioning, compatibility, and API design standards. topic:architecture System design, component boundaries, data/control flow, architectural decisions, and RFCs. topic:documentation Architecture docs, READMEs, project website updates, and automated documentation generation. topic:policy Policy authoring, validation, proving, distribution, enforcement, ergonomics, and hardening.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(rfc): RFC 0020, Cedar as an alternate sandbox policy language

5 participants