mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 10:55:17 +00:00
Fixed webhook security concern
This commit is contained in:
parent
000f0ba93e
commit
0f893bc492
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue