Webhook Security
Verify Webhook Credentials
Always verify that webhooks come from Lettr, not malicious actors. Lettr supports Basic Auth and OAuth 2.0 for webhook authentication — configure your preferred method when creating the webhook in the dashboard.IP Allowlisting
You can optionally restrict webhook access to known IP addresses as an additional layer of defense:IP allowlisting should be used as a supplementary security measure alongside credential verification, not as a replacement.
Input Validation
Validate Email Addresses
Never trust email addresses from inbound emails:Sanitize Email Content
Sanitize HTML content before displaying or storing:Validate and Sanitize Filenames
Never use attachment filenames directly:Attachment Security
Validate File Types
Never trust the declared content type:Scan for Malware
Integrate with a virus scanner:Limit File Sizes
Enforce size limits to prevent resource exhaustion:Content Security
Prevent XSS in Displayed Emails
When displaying email content in a web interface:Block Tracking Pixels
Strip tracking pixels from received emails:Rate Limiting
Protect against email flooding:Logging and Monitoring
Audit Logging
Log all inbound email processing:Anomaly Detection
Monitor for suspicious patterns:Security Checklist
Webhook Security
Webhook Security
- Verify webhook credentials (Basic Auth or OAuth 2.0) on every request
- Store credentials securely in environment variables
- Use HTTPS for your webhook endpoint
- Consider IP allowlisting as additional protection
Input Validation
Input Validation
- Validate all email addresses
- Sanitize HTML content before storage/display
- Sanitize filenames before use
- Validate attachment content types
Attachment Security
Attachment Security
- Verify file types from content, not headers
- Scan attachments for malware
- Enforce size limits
- Store attachments outside web root
Monitoring
Monitoring
- Log all inbound email processing
- Monitor for rate limit violations
- Alert on anomalous patterns
- Track spam score distributions
Related Topics
Webhook Authorization
Secure webhook endpoints
Spam Filtering
Filter spam emails
Attachments
Handle attachments safely
Best Practices
Overall best practices