You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(security): limit WASI filesystem access in file-ops to necessary directories only
Replaces full filesystem access (--dir=/::/ ) with limited directory mappings
in the file-ops external WASM wrapper. This improves security by granting WASI
access only to directories actually needed for file operations.
**Changes:**
- tools/file_ops_external/main.go: Add path resolution and limited directory mapping
- Parse file-ops arguments to identify file/directory paths
- Resolve symlinks to real paths (handles Bazel sandbox symlinks)
- Map only necessary directories to WASI (not entire filesystem)
- Add debug logging for mapped directories
**Security Impact:**
Before: WASI had full filesystem access (--dir=/::/ )
After: WASI only accesses directories containing source/dest files
**Benefits:**
✅ Maintains WASI security model (limited filesystem access)
✅ Maintains Bazel sandbox hermeticity
✅ Works with Bazel's symlinked sandbox paths
✅ Follows same approach as wasmsign2 wrapper
**Testing:**
- Verified file copy operations work correctly
- Tested with Go component builds (calculator_component)
This change aligns file-ops with the wasmsign2 wrapper security model,
ensuring both tools maintain proper WASI security boundaries.
0 commit comments