fix(test): use NTFS junctions and platform guards for symlink tests on Windows#28747
Merged
Takhoffman merged 2 commits intoopenclaw:mainfrom Mar 2, 2026
Merged
Conversation
Contributor
Greptile SummaryThis PR fixes 6 Windows test failures caused by symlink privilege requirements by using two strategies: NTFS junctions for directory symlinks (which don't require elevated privileges and are correctly identified by
Confidence Score: 5/5
Last reviewed commit: 904f274 |
…n Windows On Windows, creating symbolic links requires SeCreateSymbolicLinkPrivilege (admin or Developer Mode). This causes 7 test failures across 4 files: - apply-patch.test.ts: 4 failures - archive.test.ts: 1 failure - fs-bridge.test.ts: 1 failure - validate-sandbox-security.test.ts: 1 failure Fix: - For directory symlinks: pass 'junction' type to fs.symlink(). NTFS junctions don't require elevated privileges and lstat().isSymbolicLink() correctly returns true for them, so security checks still exercise the real code path. - For file symlinks: skip on Windows with platform guard, matching the existing pattern already used in adjacent tests. - For validate-sandbox-security: move the platform guard before the symlinkSync call (was after it, causing EPERM before the guard ran).
e1c636f to
ae90023
Compare
Contributor
|
PR #28747 - fix(test): use NTFS junctions and platform guards for symlink tests on Windows (#28747) Merged after verification.
|
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Mar 2, 2026
…n Windows (openclaw#28747) thanks @arosstale Verified: - pnpm install --frozen-lockfile - pnpm test src/agents/apply-patch.test.ts src/agents/sandbox/fs-bridge.test.ts src/agents/sandbox/validate-sandbox-security.test.ts src/infra/archive.test.ts Co-authored-by: arosstale <117890364+arosstale@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
dawi369
pushed a commit
to dawi369/davis
that referenced
this pull request
Mar 3, 2026
…n Windows (openclaw#28747) thanks @arosstale Verified: - pnpm install --frozen-lockfile - pnpm test src/agents/apply-patch.test.ts src/agents/sandbox/fs-bridge.test.ts src/agents/sandbox/validate-sandbox-security.test.ts src/infra/archive.test.ts Co-authored-by: arosstale <117890364+arosstale@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
OWALabuy
pushed a commit
to kcinzgg/openclaw
that referenced
this pull request
Mar 4, 2026
…n Windows (openclaw#28747) thanks @arosstale Verified: - pnpm install --frozen-lockfile - pnpm test src/agents/apply-patch.test.ts src/agents/sandbox/fs-bridge.test.ts src/agents/sandbox/validate-sandbox-security.test.ts src/infra/archive.test.ts Co-authored-by: arosstale <117890364+arosstale@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…n Windows (openclaw#28747) thanks @arosstale Verified: - pnpm install --frozen-lockfile - pnpm test src/agents/apply-patch.test.ts src/agents/sandbox/fs-bridge.test.ts src/agents/sandbox/validate-sandbox-security.test.ts src/infra/archive.test.ts Co-authored-by: arosstale <117890364+arosstale@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 7 test failures on Windows caused by
fs.symlink()requiringSeCreateSymbolicLinkPrivilege(admin or Developer Mode enabled).Failing tests (before this PR):
apply-patch.test.tsapply-patch.test.tsapply-patch.test.tsapply-patch.test.tsarchive.test.tsfs-bridge.test.tsvalidate-sandbox-security.test.tsApproach
Three strategies based on symlink target type:
Directory symlinks → NTFS junctions (
fs.symlink(target, link, 'junction')): Junctions don't require elevated privileges on Windows andlstat().isSymbolicLink()correctly returnstruefor them, so all security checks still exercise the real code path.File symlinks → platform guard (
if (process.platform === 'win32') return): File symlinks have no unprivileged alternative on Windows. This matches the existing pattern already used in adjacent tests (e.g.rejects broken final symlink targets outside cwd,rejects hardlink alias escapes).Guard ordering fix (
validate-sandbox-security.test.ts): The existingwin32guard was placed aftersymlinkSync("/etc", link), so the EPERM happened before the guard could skip the test. Moved the guard before the symlink creation and restructured to avoid needing a real symlink on Windows.Testing
All 4 test files pass on Windows 11 22H2 / Node v22.22.0 / NTFS (non-admin):
No changes to production code — test-only fix.
Linked Issues
None (discovered via Windows CI test run).