Verify Sanity webhook signatures in the revalidate route

The secret was passed in the query string, which ends up in access logs
and doesn't protect the request body. Verify the signed header with
@sanity/webhook instead, and return 400 for invalid JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
leanderandClaude Opus 5.5 committed 2026-10-30 21:48:49 +01:00
1 parent c5c366884a
commit c997b74d01
4 files changed
+41 -4

No files matched your search

+1
View File
@@ -15,6 +15,7 @@
"@portabletext/react": "^3.2.1",
"@sanity/client": "^7.8.1",
"@sanity/image-url": "^1.1.0",
"@sanity/webhook": "^4.0.4",
"country-flag-icons": "^1.5.19",
"install": "^0.13.0",
"next": "^16.3.3",