Dual WebView2 environments, Rust policy core, sandboxed Wasm.
Alligator separates trusted browser chrome from untrusted web content, isolates media transfers into a cookie-free Rust subprocess, and enforces strict resource budgets on every WebAssembly module.
| Subsystem | Design & Isolation Boundary |
|---|---|
Browser Core (main.rs, browser.rs) |
Rust + tao 0.38 manage window frame, tabs, native file dialogs (rfd), encrypted settings, and message routing. Browser UI runs inside a separate WebView2 environment with packaged assets, restrictive CSP, and a typed message bridge. Public tabs disable browser-to-host messages and host objects. |
Web Networking (web.rs, policy.rs) |
Chromium network stack handles TLS 1.3, HTTP/2, and HTTP/3 while Rust intercepts HTTP(S) pre-requests for URL-level ad/tracker filtering, HTTPS-Only upgrades, and top-level safety deferrals. |
Rendering & Page Tools (renderer.js) |
WebView2 supplies Blink HTML/CSS, DOM, V8, and Chromium site isolation. Alligator's Reader (closed Shadow DOM), DOM Mutation Inspector, Custom CSS, and PNG capture run inside an isolated renderer script world. |
Media Worker (media.rs) |
Clicking Save file or Save manifest spawns Alligator.exe --media-worker using reqwest + rustls (TLS 1.3, HTTP/2, optional Cloudflare DoH) — making fresh requests with zero browser cookies or credentials. |
| Process Sandbox | WebView2 isolates browser, renderer, GPU, and utility processes using Windows sandboxing and AppContainer for renderers on supported Windows configurations. |
Wasmtime 51 Plugin Sandbox
Run bundled diagnostics or load local compiled .wasm modules (up to 512 KiB). Wasmtime installs zero WASI imports, caps linear memory at 4 MiB, limits guest input/export payloads to 256 KiB, and enforces a 500,000 instruction fuel budget.
Plugins receive no filesystem handles and cannot open network sockets. Both media stream inspection (net.intercept_media_streams) and file export (fs.write_downloads) are explicit per-run opt-in grants, and exports still require user confirmation through Windows' native Save dialog.
The 4-Function alligator ABI
Modules export memory and run(), and import only the functions needed from the alligator namespace:
| Import | Contract |
|---|---|
input_len() -> i32 |
Byte size of the input JSON (or {} when media grant is off). |
read_input(ptr, cap) -> i32 |
Copies input JSON once into guest memory; returns bytes or -1. |
emit(ptr, len) -> i32 |
Emits UTF-8 report text to the Media panel (0 or -1). |
request_export(ptr, len) -> i32 |
Queues one export (0 ok, -2 grant off, -1 error). |
plugins/media-report.wat
The exact WebAssembly Text module compiled into Alligator Browser for the built-in Media Report action.
(module
(import "alligator" "input_len" (func $input_len (result i32)))
(import "alligator" "read_input" (func $read_input (param i32 i32) (result i32)))
(import "alligator" "emit" (func $emit (param i32 i32) (result i32)))
(import "alligator" "request_export" (func $request_export (param i32 i32) (result i32)))
(memory (export "memory") 4 4)
(func (export "run") (local $length i32)
call $input_len
local.set $length
i32.const 0
local.get $length
call $read_input
i32.const 0
i32.lt_s
if
unreachable
end
i32.const 0
local.get $length
call $emit
drop
i32.const 0
local.get $length
call $request_export
drop))