Overview
To ensure incoming webhook requests are authentic and secure, all outgoing requests from the platform include anX-Alloy-Signature header. This cryptographic signature allows you to verify that requests genuinely originate from our system and haven’t been tampered with, protecting your application from malicious actors attempting to spoof legitimate webhooks.
How Signature Verification Works
TheX-Alloy-Signature header is generated using RSA cryptography with our private key. You can verify this signature using our public key, which is available at:
X-Alloy-Signature header. This signature is created by:
- Concatenating the HTTP method, URL, and request body into a single string
- Generating a SHA256 hash of this concatenated string
- Signing the hash with our private RSA key
Verifying the Signature
Here’s how to verify theX-Alloy-Signature in your webhook endpoint:
TypeScript
isVerified is true, the request is legitimate and can be safely processed. If false, the request should be rejected as it may be malicious or tampered with.
Implementation Best Practices
Always verify signatures: Make signature verification a required step before processing any webhook data. Never skip this check, even in development. Cache the public key: Download the public key once and cache it locally rather than fetching it on every request. This improves performance and reduces external dependencies. Handle verification failures gracefully: Log failed verification attempts for security monitoring, but don’t expose detailed error information to potential attackers. Use constant-time comparison: When comparing signatures, use constant-time comparison functions to prevent timing attacks. Monitor verification failures: Track failed signature verifications as they may indicate attempted security breaches or configuration issues.Security Considerations
The signature verification process ensures: Authenticity: Confirms requests originate from our platform and not a third party Integrity: Guarantees the request body hasn’t been modified during transmission Non-repudiation: Provides cryptographic proof of the request’s origin Without proper signature verification, attackers could:- Send fake webhook requests to trigger unintended actions in your system
- Modify request data to corrupt your application’s state
- Execute replay attacks by resending captured legitimate requests
Troubleshooting
If signature verification consistently fails: Check string construction: Ensure you’re concatenating method, URL, and body in exactly the correct order with no separators Verify body serialization: The body must be serialized exactly as received. UseJSON.stringify() without additional formatting
Confirm public key: Ensure you’re using the correct, up-to-date public key from our CDN
Check header extraction: Verify you’re correctly extracting the X-Alloy-Signature header and converting it from hex
Review URL handling: Ensure you’re using the full URL path including query parameters

