#7507: test(ci): make tests cross-platform (Windows) + add basic sanitization util
agents
This PR makes a few tests more cross-platform-friendly (Windows PowerShell) and adds a small `sanitizeUserInput` helper for security-related flows:
- Replace `printf` usage in agent tests with a Node-based `process.stdout.write` command so tests run on Windows PowerShell
- Skip symlink test on Windows where creating symlinks often requires elevated privileges
- Add `src/security/sanitization.ts` with `sanitizeUserInput` and unit tests
All modified tests pass locally on Windows. This should reduce CI flakes on Windows runners and also provide the missing sanitization utility required by other changes.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adjusts a couple of tests to be more Windows-friendly (switching a shell `printf` to a `node -e process.stdout.write(...)` invocation, and skipping a symlink-related test on `win32`), and introduces a new `src/security/sanitization.ts` helper with accompanying unit tests.
The changes are localized to tests plus the new sanitization utility under `src/security/`, and are aimed at reducing Windows CI flakes while providing a reusable sanitization function for security-sensitive flows.
<h3>Confidence Score: 4/5</h3>
- This PR looks safe to merge; changes are mostly test-only plus a small new helper, with a few minor behavior/coverage concerns to consider.
- No obvious runtime-breaking changes were introduced; the main concerns are around the sanitization helper’s API semantics (dead type-check / potentially over-broad redaction) and reduced Windows security test coverage due to unconditional skipping.
- src/security/sanitization.ts; src/media/server.test.ts
<!-- greptile_other_comments_section -->
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#7085: test: skip flaky workspace-paths & safe-bins tests on non-Linux/CI ...
by ThinkIbrokeIt · 2026-02-02
81.8%
#9333: Tests: add test coverage for security/audit-fs.ts
by M00N7682 · 2026-02-05
80.9%
#13848: fix(test): normalize paths in source-display test for windows
by gengmao · 2026-02-11
79.0%
#5168: Fix: force UTF-8 for Windows exec
by ManojINaik · 2026-01-31
78.7%
#13318: fix(agents): prevent sanitizeUserFacingText from rewriting conversa...
by hleliofficiel · 2026-02-10
78.1%
#20496: test(utils): add comprehensive unit tests for utility functions
by masifislamm · 2026-02-19
78.0%
#12684: Test: add missing unit tests for src/utils modules
by shaynhornik · 2026-02-09
77.3%
#21733: security(exec): platform-aware allowlist matching and restricted sa...
by Esubaalew · 2026-02-20
76.8%
#10745: feat: Security improvements and Windows compatibility fixes
by lluviaoscuradeldoce-design · 2026-02-06
76.6%
#23142: fix(test): Windows CI — use path.join for XDG path assertions in qm...
by ihsanmokhlisse · 2026-02-22
76.6%