elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.68k stars 8.23k forks source link

[Discuss] Implement WebAssembly (WASM) in Kibana #199258

Open bhapas opened 2 weeks ago

bhapas commented 2 weeks ago

This goal of this issue is to discuss multiple options to implement WASM into Kibana. This focuses on WASM builds from Golang. Implementation details on Golang side are out of scope for this issue since it does not affect the way wasm module is applied in Kibana.

Background

WebAssembly is a high-performance assembly-like language that can be compiled from various languages, including C/C++, Rust, Go and AssemblyScript. Currently, it is supported by Chrome, Firefox, Safari, Edge, and Node.js!

Usecase

This issue focuses on building WASM modules from Golang. There are a few tools in Golang that can be used in Kibana for solving different problems like validations etc.,

WASM build

Currently Golang supports building the Go files/packages into wasm modules using different ports:js/wasm wasip1/wasm etc., Out of these wasip1/wasm uses Experimental WASI features in NodeJS , which means there are potential security concerns around this port usage.

That leaves us with usage of js/wasm port, which means the wasm build comes with file.wasm and JS glue filewasm_exec.js to be added to Kibana distribution.

Usage options

Risks

cc: @azasypkin @kobelb @elastic/kibana-security

elasticmachine commented 2 weeks ago

Pinging @elastic/security-scalability (Team:Security-Scalability)

bhapas commented 2 weeks ago

https://github.com/elastic/kibana/pull/198935 is added to test the wasm execution in an own Worker Thread. This seems to work fine from functionality point of view. Currently it spawns a new thread just to get the validation job done and this shall be a short-lived thread.

Now this shall be measured for performance and latency to see if it is hindered.