Skip to content

Conversation

@wingo
Copy link
Collaborator

@wingo wingo commented Sep 16, 2025

No description provided.

@wingo wingo changed the title wasi:filesystem@0.3.0-rc-2025-08-15: Add tests for symbolic links @wingo wasi:filesystem@0.3.0-rc-2025-08-15: Add tests for symbolic links Sep 16, 2025
@wingo wingo force-pushed the filesystem-symbolic-links branch 2 times, most recently from 667abf4 to b3e1496 Compare September 22, 2025 09:57
@wingo wingo changed the title wasi:filesystem@0.3.0-rc-2025-08-15: Add tests for symbolic links wasi:filesystem@0.3.0-rc-2025-09-16: Add tests for symbolic links Sep 22, 2025
@wingo wingo force-pushed the filesystem-symbolic-links branch from b3e1496 to 8285239 Compare September 22, 2025 11:44
@wingo wingo marked this pull request as ready for review September 22, 2025 14:02
@yagehu
Copy link
Contributor

yagehu commented Sep 23, 2025

Would it make sense to add this test case? WASIT found this sandbox escape in WAMR.

In short, this tests that backslashes are properly handled in symlinks.

Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed this should add coverage of cases for previously found sandbox escapes.


assert_eq!(ln_s("whatever", "").await, Err(ErrorCode::NoEntry));
assert_eq!(ln_s("", "whatever").await, Err(ErrorCode::NoEntry));
// symlink-at: async func(old-path: string, new-path: string) -> result<_, error-code>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this belong up at line 68?

@wingo wingo force-pushed the filesystem-symbolic-links branch from 8285239 to 8771068 Compare October 7, 2025 07:36
@wingo wingo force-pushed the filesystem-symbolic-links branch from 8771068 to 869e215 Compare October 7, 2025 12:16
ErrorCode::Loop
);

ln_s("parent", "parent-link").await.unwrap();
Copy link
Collaborator Author

@wingo wingo Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows Wasmtime failure:
Test filesystem-symbolic-links failed
[exit_code] 0 == 3
STDOUT:

STDERR:

thread '' (1) panicked at src/bin/filesystem-symbolic-links.rs:69:41:
called Result::unwrap() on an Err value: ErrorCode { code: 30, name: "not-permitted", message: "Operation not permitted, similar to EPERM in POSIX." }
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Error: failed to run main module tests\rust\testsuite\wasm32-wasip3\filesystem-symbolic-links.wasm

rm("self").await.unwrap();

assert_eq!(ln_s("whatever", "").await, Err(ErrorCode::NoEntry));
assert_eq!(ln_s("", "whatever").await, Err(ErrorCode::NoEntry));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasmtime MacOS failure:
Test filesystem-symbolic-links failed
[exit_code] 0 == 134
STDOUT:

STDERR:

thread '' (1) panicked at src/bin/filesystem-symbolic-links.rs:92:5:
assertion left == right failed
left: Ok(())
right: Err(ErrorCode { code: 19, name: "no-entry", message: "No such file or directory, similar to ENOENT in POSIX." })
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Error: failed to run main module tests/rust/testsuite/wasm32-wasip3/filesystem-symbolic-links.wasm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants