Skip to content

Commit 2b8a9e5

Browse files
waleedlatif1claude
andcommitted
fix(triggers): add Svix timestamp staleness check to prevent replay attacks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 38506d1 commit 2b8a9e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

apps/sim/lib/webhooks/providers/resend.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ function verifySvixSignature(
4949
rawBody: string
5050
): boolean {
5151
try {
52+
const ts = parseInt(timestamp, 10)
53+
const now = Math.floor(Date.now() / 1000)
54+
if (isNaN(ts) || Math.abs(now - ts) > 5 * 60) {
55+
return false
56+
}
57+
5258
const secretBytes = Buffer.from(secret.replace(/^whsec_/, ''), 'base64')
5359
const toSign = `${msgId}.${timestamp}.${rawBody}`
5460
const expectedSignature = crypto

0 commit comments

Comments
 (0)