Hi Guys,
We've built a third party App for Intercom Inbox. So, according to the documentation - https://developers.intercom.com/building-apps/docs/canvas-kit#section-signing-notifications , we verify the requests by generating the signature from the request body and comparing with the one Intercom sends us in the request headers. But, for some % of the requests, the signature doesn't match & it's creating a problem for the users of app.
Details:
Backend: NodeJS
const crypto = require("crypto");
const INTERCOM_APP_SECRET = "OUR_SECRET";
function verifyIntercomRequest(requestBodyRaw, signatureFromHeaders) {
const generatedSignature = crypto
.createHmac("sha256", INTERCOM_APP_SECRET)
.update(requestBodyRaw)
.digest("hex");
return signatureFromHeaders === generatedSignature;
}
We also checked the source IPs of the request & it falls into one of the following - https://developers.intercom.com/building-apps/docs/canvas-kit#section-whitelisting-i-ps
Although they are correct IPs, can't completely trust them as IPs can be spoofed
How do we debug this & move forward ?
Regards