Date: January 18, 2026 Auditor: Claude Security Review Scope: Web UI, WebSocket, Input Validation, Configuration
Overall Security Rating: B+ (Good with recommendations)
The codebase demonstrates strong security foundations with comprehensive input validation, secrets management, and error handling. Key areas for improvement include WebSocket security hardening and Gradio configuration.
None identified.
File: websocket_client.py:131-136
Issue: When base_url doesn't specify protocol, defaults to ws:// (unencrypted)
Risk: Man-in-the-middle attacks can intercept progress data and potentially inject malicious messages
OWASP: A02:2021 - Cryptographic Failures
# Current (insecure default)
else:
self.ws_url = f"ws://{http_url}/ws"Recommendation: Log a warning when using unencrypted WebSocket, document security implications.
File: websocket_client.py:165-170
Issue: No max_size parameter in websockets.connect(), allowing unlimited message sizes
Risk: Denial of Service via memory exhaustion from large messages
OWASP: A05:2021 - Security Misconfiguration
Recommendation: Add max_size=1_048_576 (1MB) to prevent DoS.
File: config.py:135, ui.py:2359
Issue: UI listens on all interfaces by default
Risk: Exposes UI to network without authentication
OWASP: A01:2021 - Broken Access Control
Recommendation: Default to 127.0.0.1 for local-only access, document network exposure.
File: websocket_client.py:344-355
Issue: Unlimited listeners can be added per prompt_id
Risk: Memory exhaustion from listener accumulation
Recommendation: Add maximum listener count per prompt_id.
File: websocket_client.py:165
Issue: No origin parameter validation in connect()
Risk: Cross-Site WebSocket Hijacking (CSWSH)
Note: Lower risk since this is a client library connecting to ComfyUI
File: pyproject.toml:57
Issue: gradio>=5.0.0 allows vulnerable versions
Risk: CVE-2025-23042 (path traversal), CVE-2025-0187 (DoS) affect versions < 5.6.0
Recommendation: Update to gradio>=5.6.0 minimum.
File: websocket_client.py:254-261
Issue: Message preview logged on JSON decode error
Risk: Potential information disclosure in logs
File: ui.py:37
Issue: client = ComfyClient() at module level
Risk: Shared state across requests in multi-user scenarios
File: ui.py:100
Issue: Hardcoded "llama3.2" instead of using config
Risk: Inconsistent configuration, not a security issue per se
- Whitelist-based character validation
- Prompt injection detection patterns
- Path traversal prevention
- HTML escaping by default
- Dimension bounds checking
- SecretValue class masks values in logs/repr
- HMAC-SHA256 with salt for hashing
- Constant-time comparison (hmac.compare_digest)
- No hardcoded credentials found
- User-friendly vs developer message separation
- No stack traces exposed to users
- Structured error codes
- Circuit breaker prevents cascade failures
- Exponential backoff with jitter
- Rate limiting (token bucket)
- Update Gradio minimum version
- Add WebSocket message size limit
- Add WSS recommendation warning
- Default UI host to 127.0.0.1
- Add listener count limits
- Document network security