configurable trans-membrance hostcall blocklist
This commit is contained in:
@@ -53,6 +53,17 @@ static String wasm_backend_ensure_started(Request* context)
|
||||
wc.memory_limit = (int64_t)to_u64(cfg["WASM_MEMORY_LIMIT_BYTES"], 512ull * 1024 * 1024);
|
||||
wc.epoch_deadline_ticks = to_u64(cfg["WASM_EPOCH_DEADLINE_TICKS"], 200);
|
||||
wc.verbose = to_bool(cfg["WASM_BACKEND_VERBOSE"], false);
|
||||
// UCE_HOSTCALL_BLOCKLIST: comma-separated uce_host_* names (with or without
|
||||
// the "uce_host_" prefix) the sysadmin disables; each blocked call traps into
|
||||
// the error page (see make_host_import). Parsed once here, per worker process.
|
||||
for(String entry : split(cfg["UCE_HOSTCALL_BLOCKLIST"], ","))
|
||||
{
|
||||
entry = trim(entry);
|
||||
if(entry.rfind("uce_host_", 0) == 0)
|
||||
entry = entry.substr(9);
|
||||
if(entry != "")
|
||||
wc.hostcall_blocklist.insert(entry);
|
||||
}
|
||||
|
||||
g_wasm_worker = new WasmWorker(wc);
|
||||
g_wasm_init_error = g_wasm_worker->init();
|
||||
@@ -131,6 +142,12 @@ String wasm_backend_serve(Request& request, const String& entry_unit, const Stri
|
||||
// Raw request body: cli_input() parses a JSON CLI payload from context.in,
|
||||
// and serve_http handlers read it as req->in; carried into the workspace.
|
||||
ctx["in"] = request.in;
|
||||
// Configurable error pages read context.call["error"] (the error_info DValue
|
||||
// set natively in render_wasm_error_page). apply_context binds context.call to
|
||||
// the decoded ctx, so marshal the native request.call children across the
|
||||
// membrane — otherwise the error page renders with no error data.
|
||||
for(auto& entry : request.call._map)
|
||||
ctx[entry.first] = entry.second;
|
||||
// WebSocket event context: the workspace owns no connections, so the frame's
|
||||
// connection identity goes in and the handler's ws_send/ws_close dispatch
|
||||
// commands come back out (below) for the native broker to apply.
|
||||
|
||||
Reference in New Issue
Block a user