Skip to content

Commit 4e6aef9

Browse files
committed
Update resource route webhook example to use timingSafeEqual
1 parent a19efb1 commit 4e6aef9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

data/docs/guides/resource-routes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ export const action = async ({
153153
.createHmac("sha256", process.env.GITHUB_WEBHOOK_SECRET)
154154
.update(JSON.stringify(payload))
155155
.digest("hex")}`;
156-
if (signature !== generatedSignature) {
156+
157+
if (!crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(generatedSignature))) {
157158
return json({ message: "Signature mismatch" }, 401);
158159
}
159160

0 commit comments

Comments
 (0)