diff --git a/CHANGELOG.md b/CHANGELOG.md index 08e1415e332..6b000feea19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Blocks of changes will separated by version increments. ## **[Unreleased]** +- [#463](https://github.com/wasmerio/wasmer/pull/463) Fix bug in WASI path_open allowing one level above preopened dir to be accessed - [#461](https://github.com/wasmerio/wasmer/pull/461) Prevent passing negative lengths in various places in the runtime C API - [#459](https://github.com/wasmerio/wasmer/pull/459) Add monotonic and real time clocks for wasi on windows - [#447](https://github.com/wasmerio/wasmer/pull/447) Add trace macro (`--features trace`) for more verbose debug statements diff --git a/lib/wasi/tests/wasitests/fs_sandbox_test.rs b/lib/wasi/tests/wasitests/fs_sandbox_test.rs new file mode 100644 index 00000000000..f9741f01ffd --- /dev/null +++ b/lib/wasi/tests/wasitests/fs_sandbox_test.rs @@ -0,0 +1,9 @@ +#[test] +fn test_fs_sandbox_test() { + assert_wasi_output!( + "../../wasitests/fs_sandbox_test.wasm", + "fs_sandbox_test", + vec![], + "../../wasitests/fs_sandbox_test.out" + ); +} diff --git a/lib/wasi/tests/wasitests/mod.rs b/lib/wasi/tests/wasitests/mod.rs index 457e1493280..0da7447af21 100644 --- a/lib/wasi/tests/wasitests/mod.rs +++ b/lib/wasi/tests/wasitests/mod.rs @@ -7,6 +7,7 @@ mod _common; mod create_dir; mod file_metadata; +mod fs_sandbox_test; mod hello; mod mapdir; mod quine; diff --git a/lib/wasi/wasitests/fs_sandbox_test b/lib/wasi/wasitests/fs_sandbox_test new file mode 100755 index 00000000000..eeddb7b0c4a Binary files /dev/null and b/lib/wasi/wasitests/fs_sandbox_test differ diff --git a/lib/wasi/wasitests/fs_sandbox_test.out b/lib/wasi/wasitests/fs_sandbox_test.out new file mode 100644 index 00000000000..e98c9da00bb --- /dev/null +++ b/lib/wasi/wasitests/fs_sandbox_test.out @@ -0,0 +1 @@ +Reading the parent directory was okay? false diff --git a/lib/wasi/wasitests/fs_sandbox_test.rs b/lib/wasi/wasitests/fs_sandbox_test.rs new file mode 100644 index 00000000000..acd9ddeb2c1 --- /dev/null +++ b/lib/wasi/wasitests/fs_sandbox_test.rs @@ -0,0 +1,10 @@ +fn main() { + #[cfg(target = "wasi")] + let result = std::fs::read_dir(".."); + #[cfg(not(target = "wasi"))] + let result: Result<(), String> = Err("placeholder".to_string()); + println!( + "Reading the parent directory was okay? {:?}", + result.is_ok() + ); +} diff --git a/lib/wasi/wasitests/fs_sandbox_test.wasm b/lib/wasi/wasitests/fs_sandbox_test.wasm new file mode 100755 index 00000000000..31c02714a68 Binary files /dev/null and b/lib/wasi/wasitests/fs_sandbox_test.wasm differ