The pieces / weirdnet-ext

weirdnet-ext

The extension host: signed packages, install and update rules, capability grants, a per-OS sandbox and a supervisor.

v0.1.1 GitHub crates.io docs.rs weirdnet-ext = "0.1.1"

What it brings

Let an app (Morph first) run third-party extensions without trusting them: signed packages pinned to their author, the user's grants checked on every call, and an OS sandbox that leaves the extension no network, no files beyond its own and no socket(). Everything goes through the host over a private gRPC socket.

Three crates in one repository: weirdnet-ext (the host side, this page), weirdnet-ext-proto (the contract) and weirdnet-ext-sdk (for extension authors).

What it is

What an app such as Morph needs to install and run third-party extensions safely: out of process, sandboxed, and reaching the app only through a gRPC broker on a private socket.

How it works

  • Packages (package): a tar archive with manifest.json, manifest.sig and the files. The author's Weirdnet user key (Ed25519) signs the exact manifest bytes, and the manifest lists every file with its size and BLAKE3. Opening checks all of it and refuses unlisted files, links, unsafe paths and oversized archives.
  • Install and update (Installer): one read-only directory per version. Each extension id is pinned to its first author, even after an uninstall. An update must be newer, and Plan::new_capabilities lists what it adds so the app can ask. Every launch hashes the files again.
  • Grants (Grants): capabilities such as page.read, net.fetch or storage, with optional * patterns, checked on every call; a revoked capability fails the next call.
  • Sandbox: empty environment, own process group, resource limits, parent-death signal, and only the private socket inherited. Linux adds no_new_privs, Landlock (files limited to the package, system libraries and the data directory; TCP denied; abstract sockets and signals scoped on 6.12+) and a seccomp filter (no socket(), namespaces, mounts, ptrace, bpf, io_uring, keyrings, modules or terminal injection). macOS uses a deny-by-default sandbox-exec profile. sandbox::probe reports what a machine gives, and the default Require::Full refuses to run with less.
  • Supervisor: starts the extension with a fresh socket pair and a one-time token, serves the broker (weirdnet.ext.v1.Host), restarts crashes with backoff and gives up after repeated ones, stops idle extensions and kills stuck ones after a grace period. App services come in through the Services trait.
OSNative extensions
Linux 5.13+Landlock + seccomp (network rules from 6.7, signal and abstract-socket scoping from 6.12)
macOSsandbox-exec deny-by-default profile
Windowsnot yet

tests-e2e builds a real extension, installs it and runs it in the sandbox, which tries to read /etc/passwd, write outside its data directory, open sockets, ptrace, unshare and use io_uring. It also covers crash restarts, idle stops, grant revocation and a tampered install.

Key types and modules

  • package: Package, Installer, Plan, Installed, build.
  • manifest: Manifest, Capability, signing and verification.
  • Grants: what the user granted, checked on every call.
  • sandbox: Policy, Require, probe (Landlock and seccomp, macOS sandbox).
  • supervisor and broker: Config, Handle, Status, the Services trait.

Feature flags

None: everything is on by default.

Usage

In Cargo.toml:

[dependencies]
weirdnet-ext = "0.1.1"

Then (built and run against the published crate when this page was made):

// What the user granted an extension, checked the way the host's broker checks each call.
use weirdnet_ext::{Capability, Grants};

fn main() {
    let mut grants = Grants(vec![Capability::new("storage"), Capability::with_patterns("net.fetch", &["https://api.example.com/*"])]);
    assert!(grants.allows("net.fetch", Some("https://api.example.com/v1/items")));
    assert!(!grants.allows("net.fetch", Some("https://elsewhere.example.org/")));
    grants.revoke("net.fetch");
    assert!(!grants.allows("net.fetch", Some("https://api.example.com/v1/items")));
}

Where it fits

Not audited. See SECURITY.md in the repository for the threat model.