Fixed webhook security concern

This commit is contained in:
Pinyoo Thotaboot
2025-05-22 15:03:15 +07:00
parent 000f0ba93e
commit 0f893bc492

View File

@ -47,6 +47,10 @@ async def get_body(request: Request):
if webhook_secret:
body_bytes = await request.body()
signature_header = request.headers.get('x-gitea-signature', None)
if not signature_header:
get_logger().error("Missing signature header")
raise HTTPException(status_code=400, detail="Missing signature header")
verify_signature(body_bytes, webhook_secret, f"sha256={signature_header}")
return body