mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-20 19:18:45 +00:00
fix(webhook): return 401 when signature header is missing
This commit is contained in:
@@ -24,6 +24,11 @@ export default async function handler(
|
|||||||
res: NextApiResponse,
|
res: NextApiResponse,
|
||||||
) {
|
) {
|
||||||
const signature = req.headers["x-hub-signature-256"];
|
const signature = req.headers["x-hub-signature-256"];
|
||||||
|
if (!signature) {
|
||||||
|
res.status(401).json({ message: "Missing signature header" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const githubBody = req.body;
|
const githubBody = req.body;
|
||||||
|
|
||||||
if (!githubBody?.installation?.id) {
|
if (!githubBody?.installation?.id) {
|
||||||
@@ -50,7 +55,7 @@ export default async function handler(
|
|||||||
|
|
||||||
const verified = await webhooks.verify(
|
const verified = await webhooks.verify(
|
||||||
JSON.stringify(githubBody),
|
JSON.stringify(githubBody),
|
||||||
signature as string,
|
signature,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!verified) {
|
if (!verified) {
|
||||||
|
|||||||
Reference in New Issue
Block a user