Skip to content

fix(driver-mxc): derive policy containment from the configured backend - #5992

Open
ytfh44 wants to merge 1 commit into
ai-openshell:mainfrom
ytfh44:fix/5990-mxc-policy-containment/ytfh44
Open

ytfh44 wants to merge 1 commit into
ai-openshell:mainfrom
ytfh44:fix/5990-mxc-policy-containment/ytfh44

Conversation

@ytfh44

@ytfh44 ytfh44 commented Nov 26, 2026

Copy link
Copy Markdown

Summary

EmbeddedPolicyMapper::map hardcoded containment: "isolation_session" for every non-egress mapping regardless of the configured MXC backend. This change threads the backend through MapCtx so containment reflects the real backend, and fails closed when a grant-only backend receives a filesystem policy it cannot enforce.

Related Issue

Closes #5990

Changes

  • crates/openshell-driver-mxc/src/policy.rs: add backend: MxcBackend to MapCtx; derive containment ("isolation_session" / "processcontainer") from ctx.backend on the non-egress path instead of hardcoding "isolation_session"; update stale comment
  • crates/openshell-driver-mxc/src/driver.rs: pass self.config.backend into MapCtx
  • crates/openshell-driver-mxc/src/policy_map/map.rs: add_static_policy_loss emits an error-severity loss when containment is isolation_session and policy.filesystem.is_some(), so CreateSandbox is rejected (the backend is grant-only with no deny primitive and cannot honor OpenShell's default-deny filesystem model)
  • Tests: new embedded_rejects_filesystem_policy_on_isolation_session; embedded_rejects_network_policy_on_isolation_session now exercises the real isolation_session backend; MapCtx literals updated in unit and integration tests

Migration note: deployments selecting backend = "isolation_session" together with a filesystem_policy will now be rejected at create time; select processcontainer (the default, genuinely default-deny backend) instead.

Release Notes

The MXC driver no longer silently accepts filesystem policies on the grant-only isolation_session backend; such sandbox creates are rejected with a clear error. Policy mapping now reports the containment of the actually configured backend.

Testing

  • Checks appropriate to the affected code and behavior pass — rustfmt --check clean on all touched files; full cargo check is blocked locally by a pre-existing environment issue (msvc_spectre_libs requires VS Spectre libs via the regorus dependency) — CI must verify
  • Unit tests added/updated — new rejection test plus updated seam/matrix/example tests
  • E2E tests added/updated (if applicable) — not applicable

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

- EmbeddedPolicyMapper hardcoded containment="isolation_session" for every non-egress mapping regardless of the configured backend, so ProcessContainer sandboxes were mapped with grant-only semantics and isolation_session sandboxes could carry filesystem policies the backend cannot enforce.
- MapCtx now carries the MxcBackend; the non-egress path derives containment ("isolation_session" / "processcontainer") from it, and the driver passes config.backend through.
- isolation_session filesystem shares are grant-only with no deny primitive, so an authored filesystem_policy would silently lose OpenShell's default-deny semantics: map_to_mxc now emits an error-severity loss and CreateSandbox is rejected. Deployments selecting backend=isolation_session with a filesystem policy must switch to processcontainer (the default, genuinely default-deny backend).

Signed-off-by: ytfh44 <82327657+ytfh44@users.noreply.github.com>

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.

driver-mxc: policy mapper hardcodes isolation_session containment regardless of backend

1 participant