Verify Message Signature
To protect your app against man-in-the-middle and replay attacks, you should verify the signature of messages sent to your application. The signature is included as anInfiniteCreator-Signature header:
InfiniteCreator-Signature: t=1633174587,s=18494715036ac4416a1d0a673871a2edbcfc94d94bd88ccd2c5ec9b3425afe66
A replay attack is when an attacker intercepts a valid payload and its signature, then re-transmits them. To mitigate such attacks, we include a timestamp in the InfiniteCreator-Signature header. Because this timestamp is part of the signed payload, it’s also verified by the signature, so an attacker can’t change the timestamp without invalidating the signature. If the signature is valid but the timestamp is too old, you can have your application reject the payload.
Infinite Creator generates the timestamp and signature each time we send an event to your endpoint. If Infinite Creator retries an event (for example, your endpoint previously replied with a non-2xx status code), then we generate a new signature and timestamp for the new delivery attempt.
Guide
1
Obtain the timestamp and signature from the header
Split the header, using the
, character as the separator, to get a list of elements. Next, split each element, using the = character as the separator, to get a prefix and value pair.The value for the prefix t corresponds to the timestamp, and s corresponds to the signature.2
Calculate your own signature
Create
signed_payload by concatenating:- The timestamp
tas a string - The character
. - The actual JSON payload (request body)
signed_payload string as the message.3
Compare the signatures
Compare the signature in the header to the signature you generated. In the case they are equal, compute the difference between the current timestamp and the received timestamp in the header. Use this to decide whether the difference is tolerable.Use Network Time Protocol (NTP) to make sure that your server’s clock is accurate. To protect against timing attacks, use a constant-time string comparison function.