Skip to content

Commit 55b998e

Browse files
committed
feat(policy): support Cedar as an alternate sandbox policy language
A sandbox policy can be written in Cedar instead of YAML. The format is chosen once per sandbox: YAML policies keep using the Rego engine unchanged, and a .cedar policy makes Cedar the sole authority for network connections, per-request L7 checks, and Landlock filesystem grants. Policy model and validation: - New crates openshell-policy-cedar-schema (canonical Cedar schema) and openshell-policy-cedar (CedarEngine). Policies are validated in strict mode, and shapes that cannot be enforced exactly as written are rejected at submission in the CLI, the gateway, and the supervisor. - Load-time analysis derives Landlock grants, the endpoints and paths inspected per request (@protocol rest, json-rpc, mcp, graphql, websocket, or websocket-graphql, scoped by @path), native TCP endpoints (@transport("tcp")), and policy DNS eligibility, including delimited host globs. - Delimited like gives YAML-style segment globs for hosts, paths, and binaries. It comes from ai-openshell/cedar, pinned by commit, with a matching deny.toml allow-git exception; its Lean specification is ai-openshell/cedar-spec. - The schema declares only what the supervisor populates: NetworkConnect carries no request fields, Process has no workdir, and a has test on an undeclared attribute is rejected. A filesystem permit must list ReadFile with WriteFile, and resource.host_port names an endpoint for policy DNS. - @enforcement("audit") provides audit endpoints and staged audit policies; decisions name policies by their @id annotation. - Request policies match query parameters through context.query tags; repeated keys are evaluated per combination of values, as YAML matches every value. - context.destination_ip restricts the resolved addresses a connection may reach, the Cedar form of allowed_ips. Permits read it only as fixed isInRange lists; connections are evaluated before DNS and again per resolved address, private addresses need an address-constrained permit or an exact host, and always-blocked destinations stay blocked. - context.binary_aliases matches symlinked binaries, resolved inside the container as YAML does, and context.binary_globs holds the glob patterns that match the calling binary or an ancestor, so YAML binary globs translate exactly. - @enforcement("staged") marks a policy that is only compared against the enforced decision; @enforcement("audit") has YAML's audit-endpoint semantics. An HttpRequest policy may name its host with a delimited glob, inspecting every matching host as a YAML wildcard endpoint does. A GraphQL path is authoritative for the requests it parses. A delimited like whose ** touches other characters, and a GraphQL-over-WebSocket message permit without a GraphQL condition, are rejected at load. Integration: - SandboxPolicy gains cedar_policy_source, the gateway-managed provider_credential_rules, and endpoint_settings. Attached providers supply credentials and token grants on requests Cedar allows but never grant access; their allowed_ips only narrow addresses. Provider rules are compiled into Cedar policies tagged with their token-grant owner, so owner selection is decided by Cedar. - The CLI accepts .cedar policies and a separate --middleware file that also carries endpoint settings (TLS skip, body limits, MCP versions, persisted queries) and the process identity; policy get renders the Cedar text, middleware, endpoint settings, process identity, and provider rules. - The gateway rejects format switches, Cedar global policies, and removal of Cedar-derived Landlock grants on live sandboxes. - Cedar sandboxes run without an OPA engine or Rego. The supervisor builds the Cedar engine at startup admission, which owns middleware state and its own generation, commits Cedar, credentials, and middleware together on reload, and applies the policy validation failure mode to Cedar. Every network decision point, including the Windows host proxy, routes through the PolicyEngine enum; Cedar tunnels pin Cedar's generation. Middleware selection is shared Rust, the data both engines hand to the proxy is typed Rust with the Rego output converted at one boundary, and engine-neutral types move out of opa.rs. - The supervisor maps JSON-RPC, MCP, GraphQL, and WebSocket requests into Cedar requests the way the YAML engine sees them: uppercase methods, calls and response frames only in a POST, and one evaluation per call, GraphQL operation, or WebSocket message. - Cedar decisions report the policy DNS records that cover a connection, so transparent TCP correlation works as for YAML. - Cedar support is the default cedar feature of openshell-policy; crates that never handle Cedar policies disable it. The Go SDK carries the new fields. - The RPM vendor archive captures the git source replacement tables cargo vendor prints, so the offline RPM build resolves the Cedar dependency. Testing and documentation: - Unit tests for the Cedar crates and supervisor integration, and an e2e:cedar suite run by mise run e2e and the Docker E2E matrix. - A parity harness runs paired YAML and Cedar policies through both engines. It ports 258 of the 260 existing YAML decision tests; the remaining one that is valid YAML needs a Cedar language change. On Linux, 2,904 of 2,909 cases agree; the 5 differences are deliberate and recorded with their reasons, an evaluation error on either side fails a case, and load rejections are asserted. Token-grant owners match YAML for every shipped provider profile. - Every example and e2e directory with a YAML policy has a Cedar version beside it, and its scripts accept POLICY_FORMAT=cedar; a parity test runs each pair through both engines. - User documentation for Cedar policies, and a crate README. Signed-off-by: Vishwanath Raman <[email protected]>
1 parent 6546691 commit 55b998e

221 files changed

Lines changed: 44918 additions & 10473 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/release-openshell/SKILL.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ release to the maintainer; once approved, tag that exact commit as `vX.Y.Z`.
1515
If no prerelease exists, agree on the version and source commit, then create and
1616
push `vX.Y.Z-pre.1`. Wait for qualification to pass before promoting it.
1717

18-
Prerelease tag pushes start Pre-release; stable tag pushes start Release.
19-
Release Auto-Tag uses an explicit dispatch because its `GITHUB_TOKEN` pushes do
20-
not trigger workflows.
18+
Both prerelease and stable tag pushes start Release Tag. Release Auto-Tag uses
19+
an explicit dispatch because its `GITHUB_TOKEN` pushes do not trigger workflows.
2120
Watch the stable release run and report its result.

‎.agents/skills/sbom/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The OpenShell SBOM tooling produces source-tree CycloneDX JSON SBOMs using Syft,
1515

1616
SBOMs are **release artifacts only** -- they are generated on demand and not committed to the repository. Output lands in `deploy/sbom/output/` (gitignored).
1717

18-
Pushed gateway, sandbox, and supervisor images carry an SPDX SBOM and minimal SLSA provenance as OCI attestations. Branch E2E, Release Dev, Release, and Pre-release image binaries embed cargo-auditable metadata, so their image SBOMs include linked Rust crates.
18+
Pushed gateway, sandbox, and supervisor images carry an SPDX SBOM and minimal SLSA provenance as OCI attestations. Branch E2E, Release Dev, and Release Tag image binaries embed cargo-auditable metadata, so their image SBOMs include linked Rust crates.
1919

2020
## Prerequisites
2121

‎.agents/skills/test-release-canary/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ they continue to exercise the dev Debian package. Kubernetes pins the matching
3333
`0.0.0-dev` chart and `:dev` images.
3434

3535
RPM package installation also has tmachine conformance coverage in
36-
`Branch E2E Checks` (with `test:e2e`), `Release Dev`, `Release`, and `Pre-release`. Those
36+
`Branch E2E Checks` (with `test:e2e`), `Release Dev`, and `Release Tag`. Those
3737
lanes use the `rpm` installer on `fedora-podman-rootful` and
3838
`fedora-podman-rootless` with candidate CLI and
3939
gateway RPMs and matching runtime images. Branch RPM package builds run on

‎.agents/skills/watch-github-actions/SKILL.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,21 @@ groups and manual runs use their explicit baseline. Findings are reported by
160160
`Reject new high or critical findings`; distinguish those from scanner failures.
161161

162162
For `Protobuf Compatibility`, check the logged train and comparison baseline.
163-
Branch Checks compares the prospective merge tree with its target; release qualification
163+
Branch Checks compares the prospective merge tree with its target; Release Tag
164164
compares the tagged candidate with the previous stable release. Both use
165165
the shared `check-protobuf-compatibility` action with `nix run .#check-protobuf-compatibility -- <ref>`.
166166
During `0.x`, a minor train permits compatibility findings
167167
as warnings; a patch train or no active train rejects them. Compare the current
168168
train's version with the latest stable release; commit messages are irrelevant.
169169
Compilation, baseline, and tool errors remain fatal. The `protobuf_compatibility` suite participates in
170-
the `release-tag-v1` qualification profile. Release and Pre-release call the reusable
170+
the `release-tag-v1` qualification profile. Release Tag calls the reusable
171171
`release-qualification.yml` workflow to run the checks and collect their results.
172-
Release builds, qualifies, then publishes. Pre-release builds, then publishes
173-
and qualifies in parallel in the same run. Failed, cancelled, or skipped required suites fail
174-
qualification; stable publication is blocked, while published pre-release
175-
artifacts remain available. The Pre-release failure notification includes the
176-
run link. Both callers share `release-build.yml` and `release-publish.yml`.
177-
Qualification evidence remains in Actions; publishing a copy to OCI storage is best effort.
178-
Snap Store uploads happen only for stable releases after qualification passes.
172+
Both tagged pre-release and stable
173+
publication require this profile to pass. Failed, cancelled, or skipped suites
174+
block publication; build artifacts and qualification evidence remain in Actions
175+
storage for diagnosis. Source-SHA images are staging inputs for qualification.
176+
Snap builds run in parallel with qualification, but tagged stable Store uploads
177+
consume those built artifacts only after qualification passes.
179178

180179
For `Codex Compatibility Review`, inspect its job summary and the
181180
`compatibility-review-run-<run-id>-attempt-<attempt>` artifact. Confirm the
@@ -193,7 +192,7 @@ share the `codex-release-review` concurrency group with `queue: max`, retaining
193192
up to 100 pending reviews while preventing overlapping API usage across runs.
194193
Either review can run first; other security scanners run in parallel.
195194
The qualification caller waits for both reviews to finish. Do not
196-
rerun Release or Pre-release to debug this reviewer. Use its dedicated manual workflow
195+
rerun Release Tag to debug this reviewer. Use its dedicated manual workflow
197196
with an existing candidate tag; that path does not publish release artifacts.
198197

199198
View logs for a specific run:

‎.github/workflows/branch-docs.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ on:
1212
- "tasks/scripts/check_docs_nav_test.py"
1313
- ".github/workflows/branch-docs.yml"
1414
- ".github/workflows/release-tag.yml"
15-
- ".github/workflows/release-prerelease.yml"
16-
- ".github/workflows/release-publish.yml"
1715

1816
permissions:
1917
contents: read

‎.github/workflows/e2e-docker-test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
required: false
3030
type: string
3131
default: >-
32-
[{"suite":"python","cmd":"mise run --no-deps --skip-deps e2e:python","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-python","cmd":"mise run --no-deps --skip-deps e2e:oidc-python:docker","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"oci-image","cmd":"mise run --no-deps --skip-deps e2e:oci-image","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true}]
32+
[{"suite":"python","cmd":"mise run --no-deps --skip-deps e2e:python","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-python","cmd":"mise run --no-deps --skip-deps e2e:oidc-python:docker","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"oci-image","cmd":"mise run --no-deps --skip-deps e2e:oci-image","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true},{"suite":"mcp-cedar","cmd":"POLICY_FORMAT=cedar mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true},{"suite":"cedar","cmd":"mise run --no-deps --skip-deps e2e:cedar","apt_packages":"","python_proto":false,"mcp":false}]
3333
3434
permissions:
3535
actions: read

‎.github/workflows/release-auto-tag.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ jobs:
8585
git tag "$NEXT_TAG"
8686
git push origin "refs/tags/$NEXT_TAG"
8787
88-
- name: Trigger Pre-release workflow
88+
- name: Trigger Release Tag workflow
8989
if: steps.version.outputs.skip != 'true'
9090
env:
9191
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9292
NEXT_TAG: ${{ steps.version.outputs.next }}
9393
run: |
94-
gh workflow run release-prerelease.yml \
94+
gh workflow run release-tag.yml \
9595
--ref main \
9696
-f tag="$NEXT_TAG"

‎.github/workflows/release-build.yml‎

Lines changed: 0 additions & 215 deletions
This file was deleted.

0 commit comments

Comments
 (0)