Skip to content

fix(fs): normalize VFS paths in HostMounts to prevent host traversal - #2281

Merged
chaliy merged 1 commit into
mainfrom
2026-08-07-fix-host-mount-resolver-vulnerability
Aug 7, 2026
Merged

fix(fs): normalize VFS paths in HostMounts to prevent host traversal#2281
chaliy merged 1 commit into
mainfrom
2026-08-07-fix-host-mount-resolver-vulnerability

Conversation

@chaliy

@chaliy chaliy commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Motivation

  • The host-path resolver could preserve ./.. in the suffix returned by strip_prefix, allowing a VFS path like /workspace/../secrets to map to a host path that the OS resolves outside the intended mount.
  • Normalize mount points and lookup paths with the VFS normalizer so the resolver matches the VFS meaning, not the raw spelling, preventing host traversal mismatches.

Description

  • Normalize recorded mount points in HostMounts::new by applying normalize_path to each HostMount.vfs_path.
  • Normalize incoming lookups in HostMounts::resolve by calling normalize_path on the vfs_path before prefix matching and joining.
  • Add regression tests parent_components_are_normalized_before_mount_selection and mount_points_are_normalized_when_the_table_is_built in crates/bashkit/tests/integration/host_mounts_tests.rs.
  • Document the invariant and add threat-model entry TM-ESC-034 in knowledge/foundations/vfs.md and knowledge/security/threat-model.md explaining that mounts and lookups are normalized before matching.

Testing

  • cargo test --features realfs -p bashkit --test integration host_mounts_tests passed (13 tests).
  • cargo fmt --check passed.
  • cargo clippy --features realfs -p bashkit --test integration -- -D warnings passed.
  • just check-okf ran and reported OKF v0.2 conformance (no failures reported).

Codex Task

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 442cd8a Commit Preview URL Aug 07 2026, 09:37 AM

@chaliy
chaliy force-pushed the 2026-08-07-fix-host-mount-resolver-vulnerability branch from e2b2463 to 29e2209 Compare August 7, 2026 09:24
@chaliy
chaliy force-pushed the 2026-08-07-fix-host-mount-resolver-vulnerability branch from 29e2209 to 442cd8a Compare August 7, 2026 09:36
@chaliy
chaliy merged commit 5ffbed1 into main Aug 7, 2026
46 checks passed
@chaliy
chaliy deleted the 2026-08-07-fix-host-mount-resolver-vulnerability branch August 7, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant