OpenShell runtime + manifest(execution) contract#282
Open
andri-coral wants to merge 8 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters
This PR adds kernel-level network mediation + filesystem ACLs + custom syscall filtering by adopting OpenShell plus a manifest contract for authors to declare egress needs.
Marketplace agents that opt into the
openshellruntime get OPA-policed network egress (default-deny + declaredexternal_hosts), Landlock filesystem ACLs, custom seccomp BPF, and irreversible UID drop through one bind-mounted ELF.Runtime
OpenShellRuntimewraps the supervisor as PID 1 of each agent container. Caps required briefly (supervisor drops to UID 65532 after policy load):SYS_ADMIN,NET_ADMIN,SYS_PTRACE,SETUID,SETGID,DAC_READ_SEARCH. Supervisor bind-mount + per-session policy dir mount; inner entrypoint forwards to the agent command.DockerLauncherobject replaced with top-levellaunchDockerContainer(spec, ctx, onLogLine)inagent/runtime/DockerExecution.kt, shared betweenDockerRuntimeandOpenShellRuntime. TheonLogLinehook parses supervisor OCSF stdout and emitsSessionEvent.EgressPolicyViolationon denial lines.Manifest contract
ExecutionPolicyResolver.validate(declared, policy, source, runtime, trust, openShellConfig)runs inGraphAgentRequest.toGraphAgent(preflight). Rejections wrap intoAgentRequestException→ HTTP 400 viaStatusPages:IsolationUnsupported— declared exceeds operator ceilingIsolationIncompatibleWithRuntime— declared CONTAINER + runtime can't provideHostDenied— declared external host hits operator deny / not in allowSandboxUnavailable— runtime = OPENSHELL but supervisor null / not executableRuntimeIncompatibleWithTrust— OPENSHELL + UID-pinned tier OR RO rootfs without/runtmpfsObservability
SessionEvent.EgressPolicyViolation(agentName, protocol, host, port)broadcasts over the existing WS event flow. coral-studio gains acase 'egress_policy_violation' → toast.warning(...).Coral-managed
allowed_ips:/32of the resolveddockerConfig.addressfor non-loopback IP literals; RFC1918 +fc00::/7fallback for hostnames or loopback (Docker Desktop on macOS resolveshost.docker.internalto IPv6 ULA inside containers).Supervisor's default
--log-level = warnhides OCSF lines; smoke config setsOPENSHELL_LOG_LEVEL = "info"via[debug.additionalDockerEnvironment].Scope and known gaps
openshell:resolve:env:*— Stage 3+ Tier 2);openshell_marketplacetier variant (UID-less profile that lets the supervisor own privilege-drop); studio Tier-3 panels forsandboxBackend+ violation feed; persistent event sink; multi-host orchestration.requireImageDigeststill default-off — flips when marketplace signs digests.Operator overrides
Agent images need
iproute2,libcap2-bin,ca-certificates,nftables, asandboxuser, and a glibc ≥ 2.38 rootfs (debian:trixie / ubuntu:noble / distroless-glibc) — seeresources/openshell/Dockerfile.example.Smoke verification
192 / 192 unit tests pass. End-to-end smoke matrix on Apple Silicon + Docker Desktop (linux/arm64 supervisor built from source, NVIDIA
28e1ff7b):api.evil.example.com)NET:OPEN MED DENIED+EgressPolicyViolationevent + agent 403RuntimeIncompatibleWithTrustSandboxUnavailableSandboxUnavailable/32allowed_ips for IP-literaldocker.address["10.42.0.1/32"]fc00::/7fallback for hostnameLinux smoke on warwick
OCSF CONFIG:APPLYING … abi:V2 compat:BestEffort→Landlock ruleset built [rules_applied:11 skipped:0]/32IPv4allowed_ipsunder live trafficallowed_ips: ["172.17.0.1/32"]; every MCP + LLM-proxy call logs[policy:coral_api engine:opa]ALLOWEDlinux/amd64supervisor end-to-endegress_policy_violation: NET:OPEN api.evil.example.com:443OCSF CONFIG:INSTALLED Bypass detection rules installed; agent's rawsocket.connect(("93.184.216.34", 443))→ConnectionRefusedError: [Errno 111]from kernel REJECTv0.0.48releaseNVIDIA/openshell@v0.0.48(+234 lines vs prior); binary verifiedopenshell-sandbox 0.0.48; agent base bumped todebian:trixie-slimfor glibc 2.38+CORAL_T2_PROBE=1: supervisor emitsOCSF NET:OPEN [MED] DENIED ... api.evil.example.com:443 [policy:- engine:opa]; coral-server emitsegress_policy_violation: NET:OPEN api.evil.example.com:443; agent seesURLError: Tunnel connection failed: 403 Forbidden