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
* Enhance documentation for path normalization and symlink handling in soft-canonicalize
* Add additional tests for symlink-first resolution order; update README and lib.rs to reflect increase in test coverage; moved `How It Works` section, lower at the lib.rs doc comments
* Bump version to 0.4.4; update CHANGELOG with documentation reorganization and new symlink-first resolution tests
* Fix: Use relative symlink target in Windows test to avoid path format issues
The test_windows_lexical_symlink_first_verification test was using an absolute
path as the symlink target, which caused path format mismatches on GitHub Actions
(extended-length prefix handling). Changed to use a relative symlink target
(../../opt/subdir/special) instead.
This simplifies the test while preserving the core verification: symlink-first
semantics (resolving symlinks before applying ..) work identically with relative
or absolute symlinks. The test still verifies full absolute path equality, not
relative paths.
* fix(anchored): clamp relative symlinks during resolution
Move relative symlink clamping into resolve_anchored_symlink_chain to
enforce virtual filesystem semantics consistently with absolute symlinks.
Relative symlinks with excessive `..` (e.g., `../../../etc/dir`) are now
clamped immediately during resolution instead of relying on caller
post-processing. Final output unchanged - improves performance and code
correctness.
- Add 7 tests in anchored_relative_symlink_clamping.rs
- Update test count: 438 → 445 (README.md, lib.rs)
- Update CHANGELOG.md for v0.4.4
Tests: 445 tests pass
* docs: update performance benchmarks and results in README files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
## [0.4.4] - 2025-10-11
11
+
12
+
### Fixed
13
+
14
+
-**`anchored_canonicalize`**: Relative symlinks with excessive `..` components are now clamped during resolution instead of relying on caller post-processing
15
+
- Improves performance by eliminating redundant safety checks
16
+
- Enforces virtual filesystem semantics at the correct layer (defense-in-depth)
17
+
- No observable behavior change - final output identical to previous versions
18
+
- Both absolute and relative symlinks now consistently clamped in `resolve_anchored_symlink_chain`
19
+
-**Windows path prefix comparison bug**: Fixed component-based comparison to properly handle Windows path prefix format differences (`Prefix::VerbatimDisk` vs `Prefix::Disk`)
20
+
- Previously, symlink clamping could fail when anchor had `\\?\` prefix but resolved symlink didn't (or vice versa)
21
+
- Added `components_equal_windows_aware` helper that treats `VerbatimDisk(C)` and `Disk(C)` as equivalent
22
+
- Fixes 3 test failures on GitHub Actions Windows runners with symlink privileges enabled
23
+
24
+
### Changed
25
+
26
+
- Documentation reorganization: "How It Works" and security sections moved lower for better user experience
27
+
- Improved discoverability and clarity of advanced implementation details
28
+
29
+
### Added
30
+
31
+
- New symlink-first resolution tests for anchored canonicalization, including Windows-compatible coverage
32
+
- Comprehensive test coverage for relative symlink clamping behavior (7 new tests in `anchored_relative_symlink_clamping.rs`)
33
+
- Feature-conditional assertions in Windows tests to properly validate dunce vs non-dunce output formats
**🚀 Works with non-existing paths** - Plan file locations before creating them
16
-
**⚡ Fast** - Mixed workload median performance (5-run protocol): Windows ~1.3x (9,907 paths/s), Linux ~1.9x (238,038 paths/s) faster than Python's pathlib
16
+
**⚡ Fast** - Mixed workload median performance (5-run protocol): Windows ~1.8x (13,840 paths/s), Linux ~3.0x (379,119 paths/s) faster than Python's pathlib
17
17
**✅ Compatible** - 100% behavioral match with `std::fs::canonicalize` for existing paths, with optional UNC simplification via `dunce` feature (Windows)
18
18
**🎯 Virtual filesystem support** - Optional `anchored` feature for bounded canonicalization within directory boundaries
19
-
**🔒 Robust** - 435 comprehensive tests including symlink cycle protection, malicious stream validation, and edge case handling
19
+
**🔒 Robust** - 445 comprehensive tests including symlink cycle protection, malicious stream validation, and edge case handling
20
20
**🛡️ Safe traversal** - Proper `..` and symlink resolution with cycle detection
21
21
**🌍 Cross-platform** - Windows, macOS, Linux with comprehensive UNC/symlink handling
22
22
**🔧 Zero dependencies** - Optional features may add dependencies
- Python baselines observed during runs: 75858, 83702, 125762, 143118, 146680 — median **125762** paths/s
60
+
- Median speedup vs Python: ~**3.02x**
61
61
62
-
#### This session (2025-10-08) — notes
62
+
#### This session (2025-10-11) — notes
63
63
64
-
- Ran the 5-run median protocol per AGENTS.md using PowerShell (Windows) and WSL (Linux). Windows used `python` (python3.13 not found); Linux used `python3.13`. These are the raw mixed-workload numbers printed by `performance_comparison.rs`. Full raw outputs saved to `target/bench-windows-*.txt` and `target/bench-linux-*.txt`.
64
+
- Ran the 5-run median protocol per AGENTS.md using PowerShell (Windows). Windows used `python` (python3.13 not found). These are the raw mixed-workload numbers printed by `performance_comparison.rs`. Full raw outputs saved to `target/bench-windows-*.txt`.
65
+
-**Windows performance improved**: Median increased from 9,907 to 13,840 paths/s (+39.7%), speedup vs Python improved from 1.31x to 1.89x
66
+
- Linux benchmarks refreshed on October 11 (same codebase; updated WSL runner state and filesystem cache yielded higher medians)
65
67
66
68
### Detailed Performance Analysis
67
69
68
70
#### Windows Performance Breakdown (October 2025, 5-run medians):
69
-
-**performance_comparison.rs** (mixed workload): 1.31x speedup vs Python baseline
Copy file name to clipboardExpand all lines: src/lib.rs
+27-23Lines changed: 27 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
//! - **⚡ Fast** - Optimized performance with minimal allocations and syscalls
14
14
//! - **✅ Compatible** - 100% behavioral match with `std::fs::canonicalize` for existing paths, with optional UNC simplification via `dunce` feature (Windows)
15
15
//! - **🎯 Virtual filesystem support** - Optional `anchored` feature for bounded canonicalization within directory boundaries
//! 2. Convert to absolute path (preserving drive/root semantics)
215
+
//! 3. Fast-path: try `fs::canonicalize` on the original absolute path
216
+
//! 4. Lexically normalize `.` and `..` (fast-path optimization for whole-path existence check)
217
+
//! 5. Fast-path: try `fs::canonicalize` on the normalized path when different
218
+
//! 6. Validate null bytes (platform-specific)
219
+
//! 7. Discover deepest existing prefix with **symlink-first** semantics: resolve symlinks incrementally, then process `.` and `..` relative to resolved targets
220
+
//! 8. Optionally canonicalize the anchor (if symlinks seen) and rebuild
221
+
//! 9. Append non-existing suffix lexically, then normalize if needed
222
+
//! 10. Windows: ensure extended-length prefix for absolute paths
223
+
//! 11. Optional: simplify Windows paths when `dunce` feature enabled
224
+
//!
225
+
//! ## Security Considerations
226
+
//!
227
+
//! - Directory traversal (`..`) uses symlink-first semantics: symlinks are resolved before applying `..`, preventing bypass attacks
228
+
//! - Symlink chains resolved with cycle detection and depth limits
229
+
//! - Windows NTFS ADS validation performed early and after normalization
0 commit comments