Skip to content

PlugFrameWork/plug

Repository files navigation

Plug: A WebAssembly Plugin Framework

logo

CI Build License: MIT

Features

  • Sandboxed WASM Runtime: Isolated memory execution using Wasmer 4.3 (Cranelift). WASI preview1 imports are explicitly allowlisted — only a safe subset of 48 syscalls exposed; dangerous ones (filesystem, network, process) blocked.
  • Granular Permissions Model: Enforces manifest-declared permissions at load time (import validation) AND call time (runtime gate) for host imports including host_get_platform. WASI imports blocked unless in explicit allowlist.
  • SSRF Protection: net_post enforces HTTPS-only, blocks private/reserved IPs (RFC1918, loopback, link-local), limits response to 1 MiB.
  • Multitab: Launch and run multiple independent plugins concurrently in separate workspace tabs.
  • Cross-Platform Native UI: Compiles to Windows (Win32 GDI) and Linux (GTK4) with zero browser engine footprint.

Overview

graph TD
    A[C++ UI Subsystem] -- Input Commands --> B(FFI Interface)
    B -- Parse / Process --> C[Rust Runtime Core]
    C -- Load / Run --> D[Wasmer Sandbox Engine]
    D -- Host Imports / Callbacks --> C
    C -- Control UI --> B
    B -- UI Updates --> A
Loading

Getting Started

Refer to docs/BUILD.md for full toolchain setup.

Quick Build

# Windows
cd plug.cross\windows && .\make.bat

# Linux
cd plug.cross/linux && ./make.sh

Console Commands

Command Args Description
/? None Displays help details.
/a None Displays system environment and memory statistics.
/tab None Spawns a new workspace tab.
/plug* None Lists available online registry plugins and hashes.
/plug [hash] Downloads and initializes a plugin.
/plug- [hash] Unloads the specified plugin.
/e None Exits the application.

See All plugins command reference for details.


Plugin Development

Plugins are compiled targeting wasm32-unknown-unknown.

extern "C" {
    fn get_args(ptr: *mut u8, max_len: usize);
    fn print_info(ptr: *const u8, len: usize);
}

#[no_mangle]
pub extern "C" fn run() {
    let mut buf = [0u8; 128];
    unsafe { get_args(buf.as_mut_ptr(), buf.len()); }
    let msg = "Hello from WASM plugin!";
    unsafe { print_info(msg.as_ptr(), msg.len()); }
}

Refer to docs/PLUGIN_DEVELOPMENT.md for details on permissions configuration (plugin.toml) and FFI imports.


Security

See docs/SECURITY.md for the complete threat model, sandbox architecture, and security controls summary.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors