A security analysis tool (Sourcery / opengrep) has flagged an insecure WebSocket usage in the JavaScript codebase:
security (javascript.lang.security.detect-insecure-websocket): Insecure WebSocket Detected. WebSocket Secure (wss) should be used for all WebSocket connections.
This indicates that at least one WebSocket connection is being established using the non-secure ws:// protocol instead of wss://. Using ws:// can expose data in transit to interception or manipulation, especially when the application is served over HTTPS.
Issue
- One or more JavaScript files are creating WebSocket connections via
ws://.
- This is a potential security vulnerability, particularly in production environments or anywhere sensitive data may be transmitted.
Expected Behavior
- All WebSocket connections should use the secure
wss:// protocol.
- WebSocket endpoints should be configured to support TLS.
Suggested Fix
- Locate all instances of
new WebSocket('ws://...') or equivalent WebSocket client code.
- Update these URLs to use
wss:// instead of ws://, for example:
// Before
const socket = new WebSocket('ws://example.com/socket');
// After
const socket = new WebSocket('wss://example.com/socket');
- Ensure the backend WebSocket server is configured with TLS and reachable via
wss://.
- If local development requires
ws://, consider:
- Using environment-based configuration (e.g.,
WS_URL env var) so production always uses wss://.
- Adding comments/config to clearly separate dev and prod behavior.
Action Items
Source of detection: opengrep / sourcery-ai security check.
I created this issue for @Its4Nik from #132 (comment).
Tips and commands
Getting Help
A security analysis tool (Sourcery / opengrep) has flagged an insecure WebSocket usage in the JavaScript codebase:
This indicates that at least one WebSocket connection is being established using the non-secure
ws://protocol instead ofwss://. Usingws://can expose data in transit to interception or manipulation, especially when the application is served over HTTPS.Issue
ws://.Expected Behavior
wss://protocol.Suggested Fix
new WebSocket('ws://...')or equivalent WebSocket client code.wss://instead ofws://, for example:wss://.ws://, consider:WS_URLenv var) so production always useswss://.Action Items
ws://) in the repository.wss://and verify connectivity with the secure endpoint.Source of detection: opengrep / sourcery-ai security check.
I created this issue for @Its4Nik from #132 (comment).
Tips and commands
Getting Help