Overview
Securing your webhook endpoints is critical to prevent:- Unauthorized access - Fake requests pretending to be from WhizoAI
- Replay attacks - Attackers re-sending captured webhook payloads
- Man-in-the-middle attacks - Intercepted and modified webhooks
- Data tampering - Modified payload data
Signature Verification
WhizoAI signs all webhook requests with HMAC-SHA256. Always verify the signature before processing events.How Signatures Work
- WhizoAI creates an HMAC signature using your webhook secret
- Signature is sent in the
X-WhizoAI-Signatureheader - Your server recalculates the signature using the same secret
- Compare signatures - if they match, the request is authentic
Implementation
Common Security Mistakes
Additional Security Measures
1. HTTPS Only
Always use HTTPS for webhook URLs. WhizoAI requires HTTPS in production:2. IP Allowlisting (Optional)
For extra security, allowlist WhizoAI’s IP addresses:Contact [email protected] for the current list of WhizoAI IP addresses.
3. Replay Attack Prevention
Prevent replay attacks by checking timestamps:4. Idempotency
Prevent duplicate processing using event IDs:5. Rate Limiting
Implement rate limiting to prevent abuse:Secret Management
Best Practices
Store Secrets Securely
Store Secrets Securely
Never hardcode secrets in your code. Use environment variables or secret management services:
Rotate Secrets Regularly
Rotate Secrets Regularly
Rotate webhook secrets every 90 days:Support both old and new secrets during rotation period:
Use Different Secrets Per Environment
Use Different Secrets Per Environment
Use separate secrets for development, staging, and production:
Error Responses
Return appropriate status codes for security errors:| Status Code | When to Use |
|---|---|
401 Unauthorized | Missing or invalid signature |
403 Forbidden | IP not allowlisted |
429 Too Many Requests | Rate limit exceeded |
500 Internal Server Error | Server-side processing error |
Monitoring & Logging
Log Security Events
Alert on Suspicious Activity
Security Checklist
1
Enable HTTPS
Use HTTPS URLs for all webhook endpoints
2
Verify Signatures
Always verify
X-WhizoAI-Signature header before processing3
Use Raw Payload
Verify signature on raw request body, not parsed JSON
4
Timing-Safe Comparison
Use
hmac.compare_digest() or equivalent to prevent timing attacks5
Check Timestamps
Reject events older than 5 minutes to prevent replay attacks
6
Implement Idempotency
Track processed event IDs to prevent duplicate processing
7
Store Secrets Securely
Use environment variables or secret management services
8
Rate Limiting
Implement rate limiting on webhook endpoints
9
Monitor & Log
Log all webhook requests and alert on suspicious activity
10
Rotate Secrets
Rotate webhook secrets every 90 days