mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 13:20:39 +08:00
Fixed webhook security concern
This commit is contained in:
@ -47,6 +47,10 @@ async def get_body(request: Request):
|
|||||||
if webhook_secret:
|
if webhook_secret:
|
||||||
body_bytes = await request.body()
|
body_bytes = await request.body()
|
||||||
signature_header = request.headers.get('x-gitea-signature', None)
|
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}")
|
verify_signature(body_bytes, webhook_secret, f"sha256={signature_header}")
|
||||||
|
|
||||||
return body
|
return body
|
||||||
|
Reference in New Issue
Block a user