Skip to content

Commit bb5b29b

Browse files
committed
test(deny-mutations): run the trailing-whitespace cases on Windows
Both cases were skipped on win32 because the trimming normalizer made a padded deny prefix compare equal to its unpadded sibling. With the comparison fixed they describe real Windows behavior, and on the old normalizer they fail for the reason that matters: the named directory stayed writable while the sibling was blocked.
1 parent c0696e5 commit bb5b29b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Security and Correctness
66

77
- Stop trimming surrounding whitespace when normalizing Windows paths for comparison, so a space-padded root no longer compares equal to its unpadded sibling and `isPathInside` keeps reporting outside paths as outside.
8+
- Apply `denyMutations` prefixes to the directory they name on Windows. A prefix with trailing whitespace previously compared equal to its unpadded sibling, so the named directory stayed writable while the sibling was blocked; the two `preserves trailing whitespace` deny-mutation cases now run on Windows instead of being skipped.
89
- Replace backtracking-prone path-segment, temp-name, and Windows device-path sanitizers with linear scans to keep attacker-controlled inputs from causing excessive CPU use.
910

1011
### Docs and Tooling

‎test/deny-mutations.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe("root denyMutations policies", () => {
116116
).rejects.toMatchObject({ code: "invalid-path" });
117117
});
118118

119-
it.skipIf(skipOnWindows)("preserves trailing whitespace in denied paths", async () => {
119+
it("preserves trailing whitespace in denied paths", async () => {
120120
const rootPath = await tempRoot("fs-safe-deny-space-");
121121
const deniedName = "secret ";
122122
const trimmedName = "secret";
@@ -131,7 +131,7 @@ describe("root denyMutations policies", () => {
131131
await expect(readFile(path.join(rootPath, trimmedName), "utf8")).resolves.toBe("allowed");
132132
});
133133

134-
it.skipIf(skipOnWindows)("preserves trailing whitespace in denied prefixes", async () => {
134+
it("preserves trailing whitespace in denied prefixes", async () => {
135135
const rootPath = await tempRoot("fs-safe-deny-prefix-space-");
136136
const deniedDir = path.join(rootPath, "private ");
137137
const trimmedDir = path.join(rootPath, "private");

0 commit comments

Comments
 (0)