Skip to main content
Security is paramount in Home Assistant. Integrations must protect user credentials, prevent unauthorized access, and handle sensitive data properly.

Authentication & Credentials

Never Log Credentials

Never log passwords, tokens, or API keys:

Secure Credential Storage

Home Assistant encrypts config entry data automatically:

OAuth2 Integration

Use OAuth2 for supported services:

Token Refresh

Handle token expiration gracefully:

Input Validation

Validate All User Input

Never trust user input:

Sanitize File Paths

Prevent Command Injection

Network Security

Use HTTPS

Always use HTTPS for API calls:

Certificate Validation

For self-signed certificates, allow user configuration:

Rate Limiting

Protect against abuse:

Code Security

Avoid eval() and exec()

Never use eval() or exec() with user input:

Secure Deserialization

Dependency Security

Keep dependencies updated:
Regularly check for vulnerabilities:

Local Network Security

Discover Devices Safely

Validate Local Connections

Webhook Security

Validate Webhook Signatures

Data Privacy

Respect User Privacy

GDPR Compliance

Allow users to export and delete their data:

Security Checklist

Before releasing your integration:
  • No credentials in logs
  • All credentials encrypted in config entries
  • Input validation on all user data
  • HTTPS with certificate validation
  • No eval() or exec() with user input
  • Safe deserialization (JSON, not pickle)
  • Rate limiting on API calls
  • Dependencies pinned and audited
  • Webhook signature validation
  • Minimal data collection
  • Data deletion on config entry removal
  • No hardcoded credentials
  • SQL injection prevention (if using SQL)
  • XSS prevention (if generating HTML)

Reporting Security Issues

If you discover a security vulnerability:
  1. Do not open a public issue
  2. Email security@home-assistant.io
  3. Include:
    • Description of vulnerability
    • Steps to reproduce
    • Potential impact
    • Suggested fix (if any)

Resources