webhook_url
you provided with the request. The webhook contains the request ID and the result of the request.
Securing your webhook endpoint(s)
To protect yourself from timing attacks, JSON parsing vulnerabilities, etc., it’s best practice to verify the webhooks you’re receiving are genuinely from QuBe Sync. If you are using Ruby with the qube_sync gem, you can verify a webhook as follows:Step 1. Get the X-Qube-Signature header
To ensure the webhook is coming from QuBe Sync, you can verify theX-Qube-Signature
header. This header contains a SHA-256 HMAC of the payload using your application’s active secret keys. You can manage your webhook secret keys in the Application’s settings.
The header will be in the following format:
Newlines have been added for readability.
Step 2. Extract the timestamp and signatures
Step 3. Compare the signatures
Compute the expected signature value by calculating the SHA256 HMAC of the timestamp and raw request body ({{timestamp}}.{{body}}
) using your application’s secret key. Then check if that matches any of the signatures in the header.
Prevent replay attacks
You can see we’re also checking the age of the timestamp to prevent replay attacks. You can choose amax_age
that makes sense for your application.