fix: back WASI random_get with crypto.getRandomValues #23
No reviewers
Labels
No labels
bug
claude:done
claude:failed
claude:in-progress
claude:ready
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Build!23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-22"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The WASI
random_getimport inwasi-runtime/runtime.jswas stubbed to return success (0) without writing any bytes into the target buffer. Everystd::random_deviceuser (or anyrandom_getcaller) therefore got all-zero "randomness".This bit 3DForts: every tab generated an identical all-zero peer id from
std::random_device, colliding WebRTC signaling routing (Catcrafts/3DForts#50).Fix
crypto.getRandomValues(a CSPRNG).QuotaExceededErrorabove that), re-viewing memory per chunk so a detached/grown buffer is handled.random_getto thebindlist — it now touchesthis.instance.exports.memory.Testing
crafter-build test— all 12 tests pass (incl.WasiBrowserRuntime).random_getimpl in Firefox against a simulated wasmWebAssembly.Memory: returns0, writes non-zero bytes, two consecutive calls differ (real entropy), and a 100000-byte buffer is fully filled past the 65536 chunk boundary (verifies chunking).Resolves #22