Webhook Signatures
To help you secure your webhook handlers so that they only respond to events sent from Trophy and not malicious attackers, Trophy includes a webhook signature with every event. This signature is sent in theX-Trophy-Signature
header and is a base64
encoded hash of the request payload, hashed using a secure webhook secret provided by Trophy.
Webhook Secrets
Each webhook you set up in Trophy has a unique webhook secret which you can access from the webhooks page in the Trophy dashboard.Make sure you store your webhook secret in a secure environment variable
and do not commit it to source control.
Securing Webhook Handlers
To validate that events your webhook handler receives do actually come from Trophy, you need to create your own hash using your secure webhook secret and compare it to the webhook signature in theX-Trophy-Signature
header.
Validating Webhook Events
If your handler detects a request that did not originate from Trophy, it’s
important to reject the request as early as possible with a
4XX
status code.