WasmtimeExecutionConfig

data class WasmtimeExecutionConfig(val target: String = WasmtimeAutomaticTarget, val precompiledModuleBytes: ByteArray? = null, val maxMemoryBytes: Long = DefaultWasmtimeMaxMemoryBytes, val maxWasmStackBytes: Long = DefaultWasmtimeMaxWasmStackBytes, val maxTableElements: Long = DefaultWasmtimeCoreMaxTableElements, val maxInstances: Long = DefaultWasmtimeCoreMaxInstances, val maxTables: Long = DefaultWasmtimeCoreMaxTables, val maxMemories: Long = DefaultWasmtimeCoreMaxMemories, val maxFuel: Long = WasmtimeUnlimitedResourceLimit)

Wasmtime engine and store configuration for a core module.

Trust boundary for precompiled artifacts

precompiledModuleBytes holds a serialized Wasmtime artifact (.cwasm). Wasmtime deserializes it with an API that Wasmtime itself documents as unsafe: the artifact is executable code (native machine code or Pulley bytecode) plus trusted runtime metadata, and it is not validated the way a .wasm module is. A crafted artifact can read and write arbitrary host memory and execute arbitrary code in the host process, bypassing fuel, memory limits and every WASI capability configured on this host.

Only pass bytes that the host itself produced from a validated .wasm module with a trusted, pinned toolchain (for example iosWasmtimeCompileModuleToCwasm, androidWasmtimeCompileModuleToCwasm or wasmtime compile) and stored where plugins cannot write. Never load precompiled bytes shipped inside a plugin bundle, downloaded from a location a plugin author controls, or otherwise supplied by an untrusted party. When in doubt, pass the .wasm bytes and let the runtime compile them.

The artifact is silently ignored and the module is compiled from .wasm when a memory policy is applied or when the module needs synthetic memory exports. It must also match the engine version, target and configuration (fuel, limits) of this host.

Constructors

Link copied to clipboard
constructor(target: String = WasmtimeAutomaticTarget, precompiledModuleBytes: ByteArray? = null, maxMemoryBytes: Long = DefaultWasmtimeMaxMemoryBytes, maxWasmStackBytes: Long = DefaultWasmtimeMaxWasmStackBytes, maxTableElements: Long = DefaultWasmtimeCoreMaxTableElements, maxInstances: Long = DefaultWasmtimeCoreMaxInstances, maxTables: Long = DefaultWasmtimeCoreMaxTables, maxMemories: Long = DefaultWasmtimeCoreMaxMemories, maxFuel: Long = WasmtimeUnlimitedResourceLimit)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard