← Back to PRs

#10745: feat: Security improvements and Windows compatibility fixes

by lluviaoscuradeldoce-design open 2026-02-06 22:57 View on GitHub →
gateway extensions: memory-lancedb scripts agents stale
## 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