#10745: feat: Security improvements and Windows compatibility fixes
gateway
extensions: memory-lancedb
scripts
agents
stale
Cluster:
OpenClaw Plugin Enhancements
## Summary
This PR includes security improvements and Windows compatibility fixes:
### Security Fixes
- **XSS Prevention**: Escape < and > characters in SSE JSON responses to prevent XSS if content-type is misinterpreted
- **Path Traversal Protection**: Validate custom sessionFile paths to prevent directory traversal attacks
### Performance
- **Async JSON operations**: Add async versions of JSON file operations for non-blocking I/O
### Compatibility
- **Windows SID fix**: Use well-known SID for Windows locale compatibility in tests
- **Qwen embeddings**: Support custom embeddings (baseUrl, dimensions) for Qwen compatibility
- **Branding fixes**: Resolve branding regressions and Windows test failures
### Testing
All changes include appropriate test coverage and have been validated on Windows.
---
**Related to**: Security hardening initiative
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Adds security hardening to gateway endpoints (SSE JSON escaping + `nosniff`, reduced error detail in some responses) and introduces session path validation to prevent traversal.
- Extends the LanceDB memory embedding configuration to support custom `baseUrl` and explicit vector dimensions.
- Introduces async JSON read/write helpers and adjusts multiple tests for Windows compatibility.
- Refactors session transcript reading/preview logic and updates some gateway error/reporting behavior.
<h3>Confidence Score: 2/5</h3>
- This PR has merge-blocking security and behavior regressions that should be fixed before merging.
- Score reduced due to an unconditional localhost auth bypass in the gateway, a likely incorrect sessions fallback directory change that can break transcript discovery, user-visible branding regressions in an API handler, and inconsistent error sanitization that can leak internal errors in streaming responses.
- src/gateway/auth.ts, src/gateway/session-utils.fs.ts, src/gateway/openresponses-http.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#11048: fix: address repository issues (env, author, CI comments, security ...
by cavula · 2026-02-07
79.3%
#13144: harden archive extraction, auth tokens, hook transforms, and queue ...
by qxlsz · 2026-02-10
78.8%
#21964: Security: harden gateway and plugin trust boundaries
by Elormyevu · 2026-02-20
78.7%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
78.6%
#7654: feat(security): zero-trust localhost auth with DNS rebinding protec...
by joncode · 2026-02-03
78.6%
#5649: fix(security): harden file permissions and header merging
by sfo2001 · 2026-01-31
78.5%
#8876: Confirmaciones para equipo de IT
by m4xjunior · 2026-02-04
78.4%
#14197: fix(security): harden browser API auth, token comparisons, and hook...
by leecarollyn-gif · 2026-02-11
78.1%
#4534: fix: packaging and OpenAI vision format conversion
by SalimBinYousuf1 · 2026-01-30
77.9%
#7346: Security: add hardening module and secure-bot extension
by AlphonseC · 2026-02-02
77.6%