Commit 6c8463e
authored
Release v0.5.5: Fix
* CI: removed redundant cargo audit in JSON format
* docs: add exotic filesystem support details to README and lib.rs
* docs: update README and lib.rs with feature comparison and test count improvements
* test: add tests for graceful fallback on exotic filesystem failures
* test: add comprehensive security coverage and cross-platform tests
Add three new security test files to close identified gaps in vulnerability coverage:
1. tests/ads_cross_platform_security.rs (256 lines, 11 tests)
- Populate previously empty file with cross-platform ADS security tests
- Windows: ADS traversal rejection, device name in ADS, non-final colon, unicode manipulation
- Unix: colon-as-literal-filename semantics, symlink handling with colons
- Covers Windows-specific alternate data stream attack vectors
2. tests/security_coverage_gaps.rs (1008 lines, 22+ tests)
- New file covering previously untested vulnerability classes:
* Unpaired UTF-16 surrogates (Windows): 7 tests on invalid Unicode handling
* Permission-change TOCTOU race conditions (Unix): 2 tests on symlink races
* Special file types (Unix): 10 tests covering FIFO, sockets, block/char devices
* Invalid UTF-8 paths (Unix): 5 tests on encoding edge cases
* Junction discrimination (Windows): 4 tests on junction vs directory behavior
* Anchored canonicalize edge cases: 6 tests on pseudo-root behavior
* Component length attacks: 4 tests on path limits
- All clippy warnings resolved (single_match conversions, needless_borrow fixes)
- All format checks pass (blank line correction)
3. tests/macos_security.rs (1059 lines, ~50 tests)
- New file with macOS-specific security tests (all gated with cfg gate)
- NFD/NFC normalization attacks
- Case-insensitive filesystem traversal
- Symlink and mount point attacks
- Resource fork and extended attribute handling
- Ready for execution on macOS CI runner
Test Results:
- All 176+ unit tests passing on Windows
- All 22 new security_coverage_gaps tests passing
- All 5 Windows ADS tests in ads_cross_platform_security passing
- All clippy checks pass with -D warnings
- All format checks pass
- MSRV 1.70 compatible with no new dependencies
Addresses security audit request: comprehensive vulnerability testing across
Windows, Unix/Linux, and macOS platforms with zero-regression parity checks.
* refactor: simplify match statements in macOS security tests
* fix: skip normalized-path fast-path when `..` is present (#53)
Lexical normalization in Stage 3 collapsed `symlink/..` without
following the symlink, causing `soft_canonicalize` to resolve to a
wrong existing path. Skip the normalized fast-path when the absolute
path contains `..` components so the slow path can resolve symlinks
before applying parent-dir traversal.
Add regression tests for the non-existing and existing suffix cases.
Closes #53
* refactor: split large test files by platform/concern and extract anchored module
Split monolithic test files into focused, single-concern modules:
- src/lib.rs: extract `anchored_canonicalize` into src/anchored.rs
- src/tests: split CVE, exotic, and platform tests by OS target
- tests/: split blackbox, feature-combination, std-compat, security,
macos, and Windows 8.3 tests into dedicated files
Also includes minor code quality improvements:
- Simplify `is_proc_magic_link` with slice pattern matching
- Remove dead `DeviceNS` payload in normalize.rs
- Avoid intermediate String allocation for drive letters
- Use safer indexing in windows.rs ADS validation
- Consolidate redundant cfg-gated symlink clamping branches
- Rewrite AGENTS.md for clarity and remove corrupted duplicate sections
* fix: gate Windows-only test imports behind #[cfg(windows)]
Imports used exclusively in #[cfg(windows)] test functions were
declared at the top level, causing unused-import errors on Linux CI
with `clippy -D warnings`.
Move the imports into the cfg-gated modules or add #[cfg(windows)]
to the use statements.
Files fixed:
- tests/security_utf16_surrogates.rs
- tests/security_junction_discrimination.rs
- src/tests/exotic_windows.rs
- src/tests/platform_windows.rs
* refactor: remove unused imports from macOS-specific test files
* fix(tests): platform-conditional assertions for issue #53 regression test
Windows resolves `symlink\..` lexically (before following the symlink),
while Unix follows the symlink first then resolves `..`. This means
`link\..\a` on Windows reaches the existing decoy `{tmp}\a` and
std::fs::canonicalize succeeds — matching that is required by the
golden rule.
Split the non-existing-suffix test assertion into #[cfg(unix)] and
#[cfg(windows)] branches:
- Unix: assert symlink-following result (nested/a)
- Windows: assert parity with std::fs::canonicalize (+ dunce guard)
* chore: update version to 0.5.5 and enhance changelog with new features and tests.. traversal bypass and expand test coverage (#54)1 parent ee5e818 commit 6c8463e
42 files changed
Lines changed: 6996 additions & 3697 deletions
File tree
- .github/workflows
- src
- tests
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
8 | 29 | | |
9 | 30 | | |
10 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
| |||
235 | 237 | | |
236 | 238 | | |
237 | 239 | | |
| 240 | + | |
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
241 | 244 | | |
242 | | - | |
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| |||
0 commit comments