Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: random deny #10

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bin/wasi-virt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn main() -> Result<()> {
// TODO: These need completing

// random
// virt_opts.random(args.allow_random.unwrap_or(allow_all));
virt_opts.random(args.allow_random.unwrap_or(allow_all));

// sockets
// virt_opts.sockets(args.allow_sockets.unwrap_or(allow_all));
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl WasiVirt {
.resolve
.select_world(*pkg_id, Some("virtual-exit"))?;
let fs_world = bindgen.resolve.select_world(*pkg_id, Some("virtual-fs"))?;
let random_world = bindgen.resolve.select_world(*pkg_id, Some("virtual-fs"))?;
let random_world = bindgen.resolve.select_world(*pkg_id, Some("virtual-random"))?;
let stdio_world = bindgen
.resolve
.select_world(*pkg_id, Some("virtual-stdio"))?;
Expand Down
14 changes: 13 additions & 1 deletion src/virt_deny.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ pub(crate) fn deny_random_virt(module: &mut Module) -> Result<()> {
vec![ValType::I64],
vec![ValType::I32],
)?;
add_stub_exported_func(
module,
"cabi_post_wasi:random/random#get-random-bytes",
vec![ValType::I32],
vec![],
)?;
add_stub_exported_func(
module,
"wasi:random/random#get-random-u64",
Expand All @@ -118,6 +124,12 @@ pub(crate) fn deny_random_virt(module: &mut Module) -> Result<()> {
vec![ValType::I64],
vec![ValType::I32],
)?;
add_stub_exported_func(
module,
"cabi_post_wasi:random/insecure#get-insecure-random-bytes",
vec![ValType::I32],
vec![],
)?;
add_stub_exported_func(
module,
"wasi:random/insecure#get-insecure-random-u64",
Expand All @@ -127,7 +139,7 @@ pub(crate) fn deny_random_virt(module: &mut Module) -> Result<()> {
add_stub_exported_func(
module,
"wasi:random/insecure-seed#insecure-seed",
vec![ValType::I64],
vec![],
vec![ValType::I32],
)?;
Ok(())
Expand Down
Loading