T09 · Insecure Skill Coding Practices
- Location
examples.md:158- Finding
Default-Enabled WebSocket Server Lacks Explicit Access Controls
- Content
View full analysis
/// Hosts a WebSocket server for external color grading UI. /// public void Update( out string status, out string lastError, int port = 9999, bool enabled = true) { lastError = null; if (port != _lastPort || enabled != _lastEnabled) { _server?.Stop(); _server = null; if (enabled) { try { _server = new WebSocketServer(port); _server.Start(); } catch (Exception ex) { lastError = ex.Message; } } _lastPort = port; _lastEnabled = enabled; } status = _server?.IsRunning == true ? $"Running on :{port}" : "Stopped"; } public void Dispose() { _server?.Stop(); _server = null; } } ``` ### Technical Analysis The example recommends a WebSocket service that is enabled by default and constructed using only a port number. It does not explicitly restrict the listening address to the loopback interface or demonstrate authentication, authorization, origin validation, transport encryption, message validation, connection limits, or rate limiting. The actual interface exposure depends on the unspecified `WebSocketServer` implementation and its default binding behavior. If it binds to all netwo ...[truncated 1796 chars]- Remediation
View remediation
