Skip to content

Commit 91dd3cd

Browse files
committed
feat(isolation): enable the co-located RFC 0012 backend
Signed-off-by: Drew Newberry <385+drew@users.noreply.github.com>
1 parent 5b589ab commit 91dd3cd

34 files changed

Lines changed: 3630 additions & 346 deletions

File tree

‎.agents/skills/helm-dev-environment/SKILL.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ mise run helm:skaffold:run
6565
mise run helm:skaffold:run:sidecar
6666
```
6767

68+
Combined topology selects RFC 0012's in-pod backend and supplies its descriptor;
69+
sidecar topology remains on its separate lifecycle.
70+
6871
**Supervisor sidecar topology with TLS/mTLS enabled** (build once and leave running):
6972
```bash
7073
mise run helm:skaffold:run:sidecar-mtls

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

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,61 @@ jobs:
161161
fi
162162
exit 0
163163
164+
isolation-conformance:
165+
name: Isolation conformance (privileged Linux)
166+
needs: pr_metadata
167+
if: needs.pr_metadata.outputs.should_run == 'true'
168+
runs-on: linux-amd64-cpu8
169+
timeout-minutes: 20
170+
container:
171+
image: ghcr.io/nvidia/openshell/ci:latest
172+
options: --privileged
173+
credentials:
174+
username: ${{ github.actor }}
175+
password: ${{ secrets.GITHUB_TOKEN }}
176+
steps:
177+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
178+
179+
- name: Install tools and network helpers
180+
run: |
181+
apt-get update
182+
apt-get install -y --no-install-recommends iproute2 nftables iptables util-linux
183+
mise install --locked
184+
185+
- name: Materialize the Alpine trusted helper runtime fixture
186+
run: |
187+
alpine_root="${RUNNER_TEMP}/openshell-alpine-root"
188+
runtime="${RUNNER_TEMP}/openshell-runtime"
189+
archive="${RUNNER_TEMP}/alpine-minirootfs.tar.gz"
190+
curl -fsSL \
191+
https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/x86_64/alpine-minirootfs-3.22.5-x86_64.tar.gz \
192+
-o "$archive"
193+
echo "4b4daa9fe2fc696c4919c4412a4c3d3e770d8fb70292a004a2c72f5096175282 $archive" \
194+
| sha256sum -c -
195+
mkdir -p "$alpine_root" "$runtime"
196+
tar -xzf "$archive" -C "$alpine_root"
197+
cp /etc/resolv.conf "$alpine_root/etc/resolv.conf"
198+
chroot "$alpine_root" /sbin/apk add --no-cache \
199+
iproute2 nftables iptables iptables-legacy
200+
for path in /bin /sbin /lib /lib64 /usr/bin /usr/sbin /usr/lib /usr/lib64 /etc/iproute2 /usr/share/nftables; do
201+
if [ -e "$alpine_root$path" ]; then
202+
(cd "$alpine_root" && cp -aL --parents ".$path" "$runtime")
203+
fi
204+
done
205+
chmod -R go-w "$runtime"
206+
207+
- name: Exercise the live default-deny ceiling
208+
run: |
209+
cargo test -p openshell-isolation -p openshell-supervisor-process \
210+
-p openshell-supervisor-network -p openshell-sandbox
211+
OPENSHELL_TEST_TRUSTED_RUNTIME_ROOT="${RUNNER_TEMP}/openshell-runtime" \
212+
cargo test -p openshell-supervisor-process \
213+
installed_egress_ceiling_ -- \
214+
--ignored --nocapture --test-threads=1
215+
cargo test -p openshell-sandbox \
216+
pid_one_exit_kills_unregistered_setsid_descendant_within_bound -- \
217+
--ignored --nocapture --test-threads=1
218+
164219
rust-macos:
165220
name: Rust lint (macOS)
166221
needs: pr_metadata

‎.github/workflows/driver-vm-linux.yml‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ jobs:
116116
username: ${{ github.actor }}
117117
password: ${{ secrets.GITHUB_TOKEN }}
118118
options: --privileged
119+
volumes:
120+
- /var/run/docker.sock:/var/run/docker.sock
119121
env:
120122
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121123
OPENSHELL_IMAGE_TAG: ${{ inputs['image-tag'] }}
@@ -141,8 +143,12 @@ jobs:
141143
cache-directories: .cache/sccache
142144
cache-targets: "true"
143145

144-
- name: Install zstd
145-
run: apt-get update && apt-get install -y --no-install-recommends zstd && rm -rf /var/lib/apt/lists/*
146+
- name: Install zstd and verify Docker
147+
run: |
148+
apt-get update
149+
apt-get install -y --no-install-recommends zstd
150+
rm -rf /var/lib/apt/lists/*
151+
docker info
146152
147153
- name: Download kernel runtime tarball
148154
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -168,14 +174,14 @@ jobs:
168174
- name: Verify embedded driver inputs
169175
run: |
170176
set -euo pipefail
171-
for file in libkrun.so.zst libkrunfw.so.5.zst gvproxy.zst umoci.zst openshell-sandbox.zst; do
177+
for file in libkrun.so.zst libkrunfw.so.5.zst gvproxy.zst umoci.zst openshell-sandbox.zst openshell-runtime.tar.zst; do
172178
test -s "target/vm-runtime-compressed/${file}"
173179
done
174180
175181
- name: Scope workspace to driver-vm crates
176182
run: |
177183
set -euo pipefail
178-
sed -i 's|members = \["crates/\*"\]|members = ["crates/openshell-driver-vm", "crates/openshell-core"]|' Cargo.toml
184+
sed -i 's|members = \["crates/\*"\]|members = ["crates/openshell-driver-vm", "crates/openshell-core", "crates/openshell-isolation"]|' Cargo.toml
179185
180186
- name: Patch workspace version
181187
if: ${{ inputs['cargo-version'] != '' }}

‎.github/workflows/driver-vm-macos.yml‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575
credentials:
7676
username: ${{ github.actor }}
7777
password: ${{ secrets.GITHUB_TOKEN }}
78+
volumes:
79+
- /var/run/docker.sock:/var/run/docker.sock
7880
env:
7981
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8082
OPENSHELL_IMAGE_TAG: ${{ inputs['image-tag'] }}
@@ -100,8 +102,12 @@ jobs:
100102
cache-directories: .cache/sccache
101103
cache-targets: "true"
102104

103-
- name: Install zstd
104-
run: apt-get update && apt-get install -y --no-install-recommends zstd && rm -rf /var/lib/apt/lists/*
105+
- name: Install zstd and verify Docker
106+
run: |
107+
apt-get update
108+
apt-get install -y --no-install-recommends zstd
109+
rm -rf /var/lib/apt/lists/*
110+
docker info
105111
106112
- name: Build bundled supervisor
107113
run: |
@@ -116,7 +122,9 @@ jobs:
116122
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
117123
with:
118124
name: driver-vm-supervisor-arm64
119-
path: target/vm-runtime-compressed/openshell-sandbox.zst
125+
path: |
126+
target/vm-runtime-compressed/openshell-sandbox.zst
127+
target/vm-runtime-compressed/openshell-runtime.tar.zst
120128
retention-days: 1
121129

122130
build-driver-vm-macos:
@@ -180,12 +188,13 @@ jobs:
180188
run: |
181189
set -euo pipefail
182190
test -f target/vm-runtime-compressed-macos/openshell-sandbox.zst
183-
ls -lh target/vm-runtime-compressed-macos/openshell-sandbox.zst
191+
test -f target/vm-runtime-compressed-macos/openshell-runtime.tar.zst
192+
ls -lh target/vm-runtime-compressed-macos/openshell-{sandbox,runtime.tar}.zst
184193
185194
- name: Verify embedded driver inputs
186195
run: |
187196
set -euo pipefail
188-
for file in libkrun.dylib.zst libkrunfw.5.dylib.zst gvproxy.zst umoci.zst openshell-sandbox.zst; do
197+
for file in libkrun.dylib.zst libkrunfw.5.dylib.zst gvproxy.zst umoci.zst openshell-sandbox.zst openshell-runtime.tar.zst; do
189198
test -s "target/vm-runtime-compressed-macos/${file}"
190199
done
191200

‎Cargo.lock‎

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎architecture/sandbox.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,34 @@ OpenShell uses overlapping controls rather than a single sandbox primitive:
5050
The supervisor may enrich baseline filesystem allowances for runtime-required
5151
paths, such as proxy support files or GPU device paths when a GPU is present.
5252

53+
## Isolation Backend
54+
55+
[RFC 0012](../rfc/0012-isolation-backend/README.md) defines the Isolation
56+
Backend contract for topology-specific boundary construction and process
57+
operations. The contract uses consuming
58+
lifecycle states (`attach` → `Bound` → `confirm` → `Ready` → `start_agent` →
59+
`Running`) so untrusted workload execution cannot begin before standing
60+
enforcement is confirmed.
61+
62+
The logical supervisor remains the trusted bridge between the gateway and the
63+
workload. It drives the backend and applies approved network policy through
64+
supervisor-owned mediation; the backend routes workload egress to that
65+
mediation. The trusted Kubernetes driver selects the co-located backend for
66+
combined topology and supplies its topology descriptor to the supervisor.
67+
Sidecar topology remains on its pre-RFC lifecycle; a conforming backend for
68+
that placement requires separate design and implementation. Docker, Podman,
69+
and VM drivers provision the same co-located topology and supply its descriptor
70+
by default. The co-located backend requires the
71+
supervisor to own the execution environment's PID namespace so boundary
72+
teardown can terminate every remaining workload process.
73+
74+
For proxy-mode boundaries, the co-located backend verifies its default-deny
75+
kernel egress ceiling before exposing any workload execution surface and then
76+
rechecks it every 250 milliseconds. Each check has a two-second deadline.
77+
Verification failure or timeout ends the boundary and triggers process cleanup;
78+
the PID-1 supervisor exits so the kernel terminates the complete workload PID
79+
namespace. The topology's detection-and-termination bound is five seconds.
80+
5381
## Network and Inference
5482

5583
See [Sandbox Limits](sandbox-limits.md) for the current numeric safety ceilings,

‎crates/openshell-core/src/driver_mounts.rs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,24 @@ mod tests {
343343
assert!(err.contains("/etc/openshell"));
344344
}
345345

346+
#[test]
347+
fn container_target_rejects_parents_that_shadow_reserved_trees() {
348+
for target in ["/opt", "/etc", "/run"] {
349+
let err = validate_container_mount_target(target).unwrap_err();
350+
assert!(
351+
err.contains("reserved OpenShell path"),
352+
"expected {target} to be rejected: {err}"
353+
);
354+
}
355+
}
356+
357+
#[test]
358+
fn container_target_rejects_proc_shadowing() {
359+
for target in ["/proc", "/proc/self", "/"] {
360+
assert!(validate_container_mount_target(target).is_err());
361+
}
362+
}
363+
346364
#[test]
347365
fn container_target_does_not_prefix_match_unrelated_paths() {
348366
validate_container_mount_target("/etc/openshell-tools").unwrap();

‎crates/openshell-driver-docker/Cargo.toml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ path = "src/main.rs"
1616

1717
[dependencies]
1818
openshell-core = { path = "../openshell-core", default-features = false, features = ["driver-extraction"] }
19+
openshell-isolation = { path = "../openshell-isolation" }
1920
openshell-otel = { path = "../openshell-otel" }
2021

2122
opentelemetry = { workspace = true }
@@ -35,15 +36,15 @@ url = { workspace = true }
3536
clap = { workspace = true }
3637
miette = { workspace = true }
3738
toml = { workspace = true }
39+
tar = "0.4"
40+
tempfile = "3"
3841

3942
[dev-dependencies]
4043
openshell-otel-test-support = { path = "../openshell-otel-test-support" }
4144
opentelemetry = { workspace = true }
4245
opentelemetry_sdk = { workspace = true, features = ["testing"] }
4346
prost-types = { workspace = true }
44-
tar = "0.4"
4547
temp-env = "0.3"
46-
tempfile = "3"
4748
tracing-subscriber = { workspace = true }
4849

4950
[lints]

0 commit comments

Comments
 (0)