← Back to Pull requests

docs,examples: a Wasmtime sandbox on the mesh under its own identity #887

Closed
unknown closed this pull request without merging on Nov 16, 2026 17:03 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 03:45 UTC
Author

Fixes #886
Refs #734

Adds a runnable example (development/examples/wasmtime-sandbox/) and companion guide (site/content/docs/guides/wasmtime.md) demonstrating how capability-isolated Wasmtime WebAssembly sandboxes join an Agent Mesh under per-sandbox workload identities (spiffe://agentmesh.local/wasm/<name>/epoch/<epoch>) — without Docker Desktop, Kubernetes CRDs, or container CNI plugins.

How it works

1. Zero-credential Wasm guest boundary (guest.wat):
- Guests execute with a 64 MiB linear-memory limit (StoreLimitsBuilder), deterministic fuel + epoch interruption (Engine::increment_epoch()), and zero ambient WASI sockets, filesystem mounts, or environment variables.
- A guest passes only a logical mesh URI (mcp://calc) and JSON payload to one narrow host import (agentmesh_wasi::mesh_call).
2. Host-side OIDC issuer & PEP exchange (src/main.rs):
- The host supervisor serves .well-known/openid-configuration and .well-known/jwks.json (ES256 / P-256 with raw 64-byte IEEE P1363 signatures) on loopback to agentmesh-one --workload-issuer=http://127.0.0.1:<port> --allowed-audiences=agentmesh.
- Outside Wasm linear memory, the supervisor mints short-lived per-sandbox JWTs (sub = spiffe://agentmesh.local/wasm/<name>/epoch/<epoch>), exchanges them at the local agentmesh-node (POST /oauth/token), strips caller Authorization / Cookie / X-Mesh-* headers, and forwards the call over the mesh with X-Mesh-Authentication: Bearer <biscuit>.
3. Interactive Makefile & single-command verification (Makefile, run.sh, check.sh):
- Mirrors the workflow in development/examples/openshell-sandbox/ and development/examples/substrate-actor/:
- make up / make sandbox NAME=demo / make call NAME=demo / make rogue / make policy / make check / make down
- ./run.sh check runs a self-contained 8-case live verification suite against agentmesh-one and agentmesh-node (v0.2.0).

Verification

  • cargo fmt -- --check & cargo clippy --all-targets -- -D warnings (0 warnings)

  • cargo test (5/5 unit tests passing: IEEE P1363 vs. ASN.1 DER rejection, JWKS key rotation, SSRF scheme blocking, header hygiene, and Wasm linear-memory secret scanning)

  • ./run.sh check against agentmesh-one + agentmesh-node v0.2.0 (8/8 live multi-node E2E invariants passing)
  • Diff: 302 lines (+226 / -76) across 3 files Reviewer: aojea Review duration: 9437m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 302 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.342
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #887"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.1% (MEDIUM) · Higher = larger blast radius
    40.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.3% · Safe to merge
    17.3%