Validate signed webhook events (admin)
Jama Connect Interchange signs ordinary webhook events after the webhook URL is verified.
Read the following request headers:
X-DS-Message-Id
X-DS-Timestamp
X-DS-Nonce
X-DS-Body-SHA256
X-DS-Signature
To validate each event:
Preserve the raw request-body bytes before parsing the JSON.
Compute SHA-256 over the raw request body.
Compare the computed value with X-DS-Body-SHA256. Reject the request if the values don’t match.
Construct the signing input in this order:
HTTPS method
Request path
X-DS-Timestamp
X-DS-Nonce
X-DS-Message-Id
X-DS-Body-SHA256
Compute HMAC-SHA256 over the signing input using the stored signature key.
Compare the computed signature with X-DS-Signature. Reject the request if the signatures don’t match.
Process the webhook event after all validation succeeds.
Important
Parse the request body only after you compute its hash. Parsing and reserializing the JSON can change the original bytes and cause validation to fail.