Skip to content

Commit db37b6e

Browse files
committed
fix(triggers): address PR review feedback for Zoom webhooks
- Add 30s timestamp freshness check to prevent replay attacks - Return null from handleChallenge when no secret token found instead of responding with empty-key HMAC - Remove all `as any` casts from output builder functions
1 parent 2720425 commit db37b6e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ function validateZoomSignature(
2929
return false
3030
}
3131

32+
const nowSeconds = Math.floor(Date.now() / 1000)
33+
const requestSeconds = parseInt(timestamp, 10)
34+
if (isNaN(requestSeconds) || Math.abs(nowSeconds - requestSeconds) > 30) {
35+
return false
36+
}
37+
3238
const message = `v0:${timestamp}:${body}`
3339
const computedHash = crypto.createHmac('sha256', secretToken).update(message).digest('hex')
3440
const expectedSignature = `v0=${computedHash}`
@@ -119,6 +125,12 @@ export const zoomHandler: WebhookProviderHandler = {
119125
}
120126
} catch (err) {
121127
logger.warn(`[${requestId}] Failed to look up webhook secret for Zoom validation`, err)
128+
return null
129+
}
130+
131+
if (!secretToken) {
132+
logger.warn(`[${requestId}] No secret token configured for Zoom URL validation on path: ${path}`)
133+
return null
122134
}
123135

124136
const hashForValidate = crypto

apps/sim/triggers/zoom/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export function buildMeetingOutputs(): Record<string, TriggerOutput> {
140140
},
141141
},
142142
},
143-
} as any
143+
}
144144
}
145145

146146
/**
@@ -187,7 +187,7 @@ export function buildParticipantOutputs(): Record<string, TriggerOutput> {
187187
},
188188
},
189189
},
190-
} as any
190+
}
191191
}
192192

193193
/**
@@ -229,7 +229,7 @@ export function buildRecordingOutputs(): Record<string, TriggerOutput> {
229229
},
230230
},
231231
},
232-
} as any
232+
}
233233
}
234234

235235
/**

0 commit comments

Comments
 (0)