Skip to content

feat(policy): support Cedar in development builds - #5006

Draft
drew wants to merge 1 commit into
drew/dev-buildsfrom
drew/cedar/dev-builds
Draft

drew wants to merge 1 commit into
drew/dev-buildsfrom
drew/cedar/dev-builds

Conversation

@drew

@drew drew commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Support Cedar-authored sandbox policies in development builds. The gateway and supervisor enable Cedar through the single experimental feature; crate boundaries forward that bundle without separate cedar switches. Default, prerelease, and stable product builds exclude Cedar.

Cedar parsing and evaluation stay in dedicated engine/schema crates. A Cedar message adapter owns analysis shared by gateway and runtime composition, and a separate runtime adapter implements neutral policy contracts. Supervisor composition selects the backend; networking enforces baseline destination restrictions before consulting opaque policy authorizers.

Related Issue

Stacked on #5005. Closes #4411. Builds on #4565. Cedar example policies and demos are reviewed separately in #4991.

Behavior

  • Presence of CedarPolicy at protobuf tag 7 selects Cedar, including empty source. Existing YAML fields retain their meanings.
  • Cedar policies support gateway validation, filesystem grants, network/L7 enforcement, provider credentials, and staged configuration reloads. Load-time warning analysis stays in policy crates without adding warning fields to public responses.
  • The CLI uses the existing --policy option for Cedar source and adds no middleware flag. Middleware, endpoint settings, and custom process identity are not configurable through the CLI for Cedar policies; existing YAML middleware is unchanged.
  • The CLI, Rust SDK, and TypeScript SDK send Cedar policies directly and display gateway rejection errors without a Cedar capability preflight. Core policy sync follows the same path; the health API remains unchanged. The CLI, TUI, and TypeScript SDK do not advertise runtime enforcement capabilities. Supervisor capability negotiation remains in place. Gateways predating the Cedar protobuf field may ignore it; Cedar requires compatible development gateway and supervisor builds.
  • Endpoint settings and provider configuration retain their existing API shapes. Providers supply credentials without granting Cedar access.

Validation

  • 2,595 policy, networking, and CLI tests passed for the CLI cleanup; four tests remain ignored. After removing CLI capability checks, all 559 CLI tests and the gateway rejection test passed again.
  • Without Cedar: default product dependency graphs and gateway/supervisor compile checks passed, along with YAML policy and gateway/supervisor rejection tests.
  • Feature-bundle cleanup passed 207 Cedar-focused tests with experimental, 283 default policy tests, and 18 default gateway/supervisor Cedar rejection tests. Gateway/supervisor compile and dependency-graph checks passed with the bundle enabled and disabled.
  • The core boundary cleanup passed 612 core tests, 15 server Cedar compatibility tests, and 3 CLI Cedar regression tests.
  • Server scope cleanup passed 2,475 server tests plus the updated schema inventory check; 33 tests remain ignored. Strict Clippy passed across server, SDK, and CLI targets.
  • Strict Clippy across affected crates passed.
  • All 37 Cedar Docker E2E checks passed with the rebuilt CLI and existing Cedar gateway/supervisor/sandbox artifacts. The local debug supervisor image used the distroless C++ base for libgcc_s; production image defaults are unchanged.
  • Rust SDK and TUI tests passed, and strict Clippy passed for both crates. The Rust SDK and its tests have no remaining diff.
  • TypeScript SDK CI passed locally, including 197 tests.
  • Rust formatting, Markdown lint, shell syntax, strict protobuf compatibility, and whitespace checks passed.

Release Notes

Development builds can create and enforce sandboxes with Cedar policies. YAML policies keep their existing behavior.

@copy-pr-bot

copy-pr-bot Bot commented Oct 28, 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.

@drew
drew added this pull request to stack #5007 October 28, 2026 15:43
@github-actions

Copy link
Copy Markdown

@vishwa-raman vishwa-raman left a comment

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.

Drew, I went through #5006 against vishwa/cedar-openshell and the goals we set for bringing Cedar in. The direction looks right to me: the runtime interface, the separate adapter and runtime crates, and composing the backend in the supervisor are cleaner than what we had. One issue blocks the merge and a few others need answers.

What I verified

  • Parity is intact. All 147 parity tests moved to tests/policy-conformance under the same names. On macOS they pass on both branches (149 passed, the same 3 Linux-only symlink tests ignored). expected.json records the same 7 YAML/Cedar differences the old harness documented, with no new ones. I like that each backend is now checked against its own expected outcome.
  • The stable dependency graph is clean. cargo tree -e normal -i cedar-policy finds nothing for openshell-gateway, -supervisor, -cli, -sandbox or -tui with default features. With --features experimental, the gateway and supervisor resolve the ai-openshell/cedar fork.
  • Supervisor negotiation is right. POLICY_CEDAR_V1 is only advertised under cfg!(feature = "experimental").

Blocker

The stable RPM build fails offline resolution. 3a4a04506 deletes deploy/rpm/create-vendor-archive.sh and returns .packit.yaml and openshell.spec to main's versions. But Cargo.lock lists the ai-openshell/cedar git source in every build, with or without experimental. %cargo_prep only redirects crates.io to the vendored copy, so offline resolution fails on the git source even when nothing compiles Cedar:

cargo vendor --locked vendor > /dev/null
CARGO_HOME=$(mktemp -d) cargo tree --offline --locked -e normal -p openshell-gateway \
  --config 'source.crates-io.replace-with="vendored-sources"' \
  --config 'source.vendored-sources.directory="vendor"'
# error: can't checkout from 'https://github.com/ai-openshell/cedar.git': you are in the offline mode

(If mise shims cargo, use the toolchain's cargo binary directly. Overriding CARGO_HOME breaks the shim.)

openshell-cli and openshell-supervisor fail the same way. With the [source."git+…"] mapping the old script wrote, resolution succeeds. The vendoring script, or something equivalent, needs to stay as long as the lockfile carries a git source.

Needs an answer before merge

  1. driver_enforces_policy removal. The field and its admission check are gone from compute_driver.proto and all six drivers. Does MXC on the windows branch rely on it to keep out policies it can't enforce? If so, the removal needs a replacement there.
  2. Older gateways silently dropping Cedar. Without the health flag and the client-side check, a gateway that predates CedarPolicy drops tag 7 and accepts the request as an empty YAML policy (which passes validation on main). The docs cover it, but I couldn't establish what an empty policy enforces on the filesystem. Could we confirm it fails closed, ideally with an e2e against a current stable gateway?
  3. Policy warnings. policy_warnings and PolicyWarning are removed entirely, so load-time analysis (for example, audit-only rules next to enforced rules on the same endpoint) is computed but never shown to the author. Was dropping them intended, or should a small additive field come back later?

Follow-ups (fine after merge)

  • A CI check that stable builds exclude Cedar. The boundary is clean today, but with verify-cedar-off.sh gone nothing would catch a regression. A cargo tree -i cedar-policy check that must fail, following the webpki/telemetry pattern in tasks/rust.toml, would cover it.
  • Configuring Cedar sandboxes through the CLI. With --middleware gone, the CLI can't set middleware, endpoint_settings or process identity on a Cedar policy. That matches the plan, but it should have a tracking issue.
  • Rollout paragraph in the RFC (#4564): Cedar is opt-in and dev-only, with criteria for promoting it.
  • Commit messages and review size. The 21 refactor commits have no message bodies, and the API changes (cedar_policy as a message, capability strings, the warning and driver-field removals) are mixed into a 222-file diff. Short bodies on 3a4a04506, 73419b00c and 7e66b3491 would help other reviewers.

vishwa-raman added a commit that referenced this pull request Nov 22, 2026
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>
@drew

drew commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

On driver_enforces_policy: it didn't exist on main or windows (it was added earlier in this branch and then removed), so MXC doesn't rely on it.

Without it, if an experimental gateway sends a Cedar policy to MXC, MXC's policy mapper sees empty YAML fields (no filesystem grants and default-deny network), so it fails closed. That's fine for now. If MXC wants an explicit rejection later, its mapper can reject policy.cedar_policy.is_some() directly rather than adding a field to compute_driver.proto.

Signed-off-by: Drew Newberry <anewberry@nvidia.com>
@drew
drew force-pushed the drew/cedar/dev-builds branch from 82d6ec4 to 90b71d5 Compare November 23, 2026 16:52
@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

SandboxPolicy gains cedar_policy, provider_credential_rules, and endpoint_settings, while GetSandboxConfigRequest and SupervisorHello gain supported_capabilities, changing their exhaustive Rust message shapes.

  • Impact: Existing raw SDK consumers using complete struct literals or exhaustive patterns no longer compile, even for YAML-only usage; callers using defaults and non-exhaustive patterns remain compatible.
  • Action: Preserve the existing raw message shapes for v0.1.10, or defer these additions to a minor train with notice and migration guidance using ..Default::default() for literals and .. for patterns.
  • PR: feat(policy): support Cedar in development builds #5006
Review details
  • Execution: complete
  • Candidate: PR #5006 (46ffc91982176b2fd585f362f6759bcf9fb02fbd)
  • Baseline: 4ea2e32ebd67db79a166bd925e0beeaf6c2c6e71 (4ea2e32ebd67db79a166bd925e0beeaf6c2c6e71)
  • Reviewed: rust-sdk, python-sdk, api-behavior, cli, configuration, policy, helm, state

Advisory review; publication gates are unchanged.

Branch check run

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(policy): Cedar as a policy language in OpenShell

2 participants