Skip to content

feat(execd): add isolation package with bwrap support#1008

Draft
Pangjiping wants to merge 4 commits into
opensandbox-group:mainfrom
Pangjiping:osep-0013-phase1-isolation-core
Draft

feat(execd): add isolation package with bwrap support#1008
Pangjiping wants to merge 4 commits into
opensandbox-group:mainfrom
Pangjiping:osep-0013-phase1-isolation-core

Conversation

@Pangjiping

Copy link
Copy Markdown
Collaborator
  • Add pkg/isolation/ package: Isolator interface, bwrap argv builder, startup probe, upper directory management, seccomp loading
  • Switch bwrap distribution from //go:embed to Dockerfile static build (musl-gcc) and init container injection alongside execd
  • Add isolation flags (upper root, max bytes, diff max bytes, allowed writable) with env var overrides
  • Add smoke test: Docker build, extract binaries, verify static link, bwrap namespace test, execd probe
  • Add smoke_bwrap.sh to CI workflow (ubuntu-latest only)
  • Defer diff/commit to Phase 2 (stub returning 503)

Summary

  • What is changing and why?

Testing

  • Not run (explain why)
  • Unit tests
  • Integration tests
  • e2e / manual verification

Breaking Changes

  • None
  • Yes (describe impact and migration path)

Checklist

  • Linked Issue or clearly described motivation
  • Added/updated docs (if needed)
  • Added/updated tests (if needed)
  • Security impact considered
  • Backward compatibility considered

@Pangjiping Pangjiping force-pushed the osep-0013-phase1-isolation-core branch 14 times, most recently from 45245e8 to 03cbe0b Compare June 9, 2026 14:44
…e 1)

- Add pkg/isolation/ package: Isolator interface, bwrap argv builder,
  startup probe, upper directory management, seccomp loading
- Switch bwrap distribution from //go:embed to Dockerfile static build
  (musl-gcc) and init container injection alongside execd
- Add isolation flags (upper root, max bytes, diff max bytes, allowed
  writable) with env var overrides
- Add smoke test: Docker build, extract binaries, verify static link,
  bwrap namespace test, execd probe
- Add smoke_bwrap.sh to CI workflow (ubuntu-latest only)
- Defer diff/commit to Phase 2 (stub returning 503)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Pangjiping Pangjiping force-pushed the osep-0013-phase1-isolation-core branch 12 times, most recently from 040edea to 19a3775 Compare June 10, 2026 06:09
@Pangjiping Pangjiping force-pushed the osep-0013-phase1-isolation-core branch 3 times, most recently from 6163613 to 22d8a0f Compare June 10, 2026 09:59
- Add isolated session model types and /v1/isolated/* router (17 endpoints)
- Implement session lifecycle: Create/Get/Run/Delete with bwrap+bash
- SSE streaming via basicController writeSingleEvent (context-aware)
- MergedView overlay filesystem with whiteout support (20 unit tests)
- Filesystem proxy endpoints (10 handlers via MergedView)
- Idle GC: background goroutine scavenges sessions past idle_timeout
- Bwrap integration tests (43 tests, linux+bwrap build tag)
- Isolated session unit tests (15 tests, stub isolator)
- CI job bwrap-smoke: meson build bwrap v0.11.2 + sudo go test
- Windows stubs for cross-platform compilation
- Fix: cmd.Wait() zombie cleanup, context cancellation propagation,
  setpriv skip when uid=0, correct v0.11.x overlay syntax

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Pangjiping Pangjiping force-pushed the osep-0013-phase1-isolation-core branch from 26158ac to 29a6549 Compare June 10, 2026 11:47
…ts (OSEP-0013)

Seccomp BPF:
- pkg/isolation/seccomp_gen.go — BPF generator (elastic/go-seccomp-bpf, pure Go)
- Default-allow denylist: 40+ dangerous syscalls blocked (mount, ptrace, etc.)
- BPF passed to bwrap via memfd + ExtraFiles fd

Telemetry:
- execd.isolation.session.count (gauge)
- execd.isolation.run.duration (histogram, ms)
- execd.isolation.upper.usage_bytes (gauge)
- IsolationStatsProvider pattern for gauge callbacks

OpenAPI Spec:
- specs/execd-api.yaml: 17 endpoints, 10 schemas, ServiceUnavailable response

Integration tests (64 total in bwrap_test/):
- 5 seccomp tests (filter active, normal syscalls, ptrace block, mount block, persist)
- 3 ExtraWritable tests (write, read-write roundtrip, multiple sessions)
- 11 gap-coverage tests (stderr, recovery, cancellation, network iso, 100x stress, delete-recreate, bash builtins, large file, subprocess cleanup, buffer size, workspace isolation)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Pangjiping Pangjiping force-pushed the osep-0013-phase1-isolation-core branch from 284f75f to af39baa Compare June 10, 2026 15:39
17 endpoints, 10 new schemas, ServiceUnavailable response.
FS proxy endpoints reuse same schemas as /files/* and /directories/*.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Pangjiping Pangjiping force-pushed the osep-0013-phase1-isolation-core branch from 584f722 to bf1bfdd Compare June 10, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant