Security: Fix critical vulnerabilities (includes fr4iser90 PR #38 + fix) #42

Merged
ruvnet merged 7 commits from security/fix-critical-vulnerabilities into main 2026-03-01 10:44:00 +08:00
Showing only changes of commit e320bc95f0 - Show all commits

View File

@@ -107,11 +107,11 @@ export function buildApiUrl(endpoint, params = {}) {
// Helper function to build WebSocket URLs // Helper function to build WebSocket URLs
export function buildWsUrl(endpoint, params = {}) { export function buildWsUrl(endpoint, params = {}) {
// Always use secure WebSocket (wss://) in production or when using HTTPS // Use secure WebSocket (wss://) when serving over HTTPS or on non-localhost
// Use ws:// only for localhost development // Use ws:// only for localhost development
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'; const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
const isProduction = window.location.protocol === 'https:' || process.env.NODE_ENV === 'production'; const isSecure = window.location.protocol === 'https:';
const protocol = (isProduction || !isLocalhost) const protocol = (isSecure || !isLocalhost)
? API_CONFIG.WSS_PREFIX ? API_CONFIG.WSS_PREFIX
: API_CONFIG.WS_PREFIX; : API_CONFIG.WS_PREFIX;