This document outlines security considerations and best practices for the Coreflux MCP Server.
The server implements comprehensive log sanitization to prevent sensitive information from being exposed in log files:
- API Keys and Tokens: All API keys, bearer tokens, and authentication tokens are automatically redacted
- Passwords: All password fields are sanitized regardless of format
- Certificates: Certificate content and file paths are redacted
- File Paths: Sensitive file paths are obfuscated
- URLs with Credentials: URLs containing credentials are sanitized
The following patterns are automatically detected and sanitized:
Bearer <token>
→Bearer [REDACTED]
api_key: <value>
→api_key: [REDACTED]
password: <value>
→password: [REDACTED]
- Certificate content →
[CERTIFICATE REDACTED]
- File paths →
[FILE PATH REDACTED]
Always use environment variables or .env
files for sensitive configuration:
# Good
MQTT_PASSWORD=secret_password
DO_AGENT_API_KEY=your_api_key
# Bad - don't hardcode in source
mqtt_password = "secret_password"
When using TLS for MQTT connections:
- Use strong certificates: Ensure certificates are from trusted CAs
- Secure certificate storage: Store certificates outside the application directory
- File permissions: Restrict certificate file permissions (600 or 400)
- Certificate rotation: Implement regular certificate rotation
When running in Docker:
- Non-root user: The container runs as a non-root user (
mcpserver
) - Read-only certificates: Certificate volumes are mounted read-only
- Resource limits: Memory and CPU limits are enforced
- Security scanning: Regularly scan the Docker image for vulnerabilities
- Use TLS: Always use TLS in production environments
- Authentication: Use strong MQTT credentials
- Client certificates: Consider client certificate authentication for enhanced security
- Network isolation: Run MQTT broker in isolated network segments
Configure firewall rules to restrict access:
- MQTT port (1883/8883): Only from authorized networks
- MCP Server: Only accessible from Claude Desktop or authorized clients
- API Key Protection: Store API keys securely using environment variables
- Rate Limiting: Be aware of API rate limits
- Request Validation: All API requests are validated before sending
- Error Handling: API errors are logged without exposing sensitive details
- Use environment variables for all sensitive configuration
- Enable TLS for MQTT connections
- Use strong, unique passwords
- Implement proper certificate management
- Configure appropriate log levels (INFO or WARNING in production)
- Set up log rotation and retention policies
- Enable container security scanning
- Use secrets management for production deployments
- Implement network segmentation
- Regular security updates
For production deployments, consider using:
- Docker Secrets
- Kubernetes Secrets
- HashiCorp Vault
- Cloud provider secret managers (AWS Secrets Manager, Azure Key Vault, etc.)
- Log Analysis: Monitor logs for authentication failures and suspicious activity
- Connection Monitoring: Track MQTT connection patterns
- API Usage: Monitor Coreflux Copilot API usage for anomalies
- Health Checks: Implement comprehensive health monitoring
- Log Retention: Maintain logs for forensic analysis
- Alerting: Set up alerts for security events
- Containment: Have procedures for isolating compromised systems
- Recovery: Implement backup and recovery procedures
If you discover a security vulnerability, please:
- Do not open a public issue
- Contact the maintainers privately
- Provide detailed information about the vulnerability
- Allow time for the issue to be addressed before public disclosure
- Regularly update dependencies using
pip install -r requirements.txt --upgrade
- Monitor security advisories for used packages
- Update base Docker images regularly
- Subscribe to security notifications for Coreflux and related components