vmware-labs / webassembly-language-runtimes

Wasm Language Runtimes provides popular language runtimes (Ruby, Python, …) precompiled to WebAssembly that are tested for compatibility and kept up to date when new versions of upstream languages are released
Apache License 2.0
327 stars 27 forks source link

fix random_bytes failing on Windows #91

Closed juamedgod closed 1 year ago

juamedgod commented 1 year ago

We are not currently providing a way to get random bytes in wasi mode so it fallbacks to read from "/dev/urandom", which works when the module is running on Unix (and has permissions) but will always fail on Windows, where it does not exist.

The patch provides a way of getting random bytes using getentropy and disables relying on "/dev/urandom" as a fallback.