fix(webhook): Gitea 簽章格式修正 — 純 hex,無 sha256= 前綴
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m12s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m12s
Gitea X-Gitea-Signature 送出純 hex(與 GitHub X-Hub-Signature-256 不同) - router: 兩種格式皆接受(向後相容) - tests: generate_signature 改為純 hex(符合 Gitea 實際行為) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -138,13 +138,16 @@ def ping_payload():
|
||||
|
||||
|
||||
def generate_signature(secret: str, body: bytes) -> str:
|
||||
"""生成 Gitea Webhook 簽章 (X-Gitea-Signature)"""
|
||||
signature = hmac.new(
|
||||
"""生成 Gitea Webhook 簽章 (X-Gitea-Signature)
|
||||
|
||||
Gitea 送出純 hex(無 sha256= 前綴),與 GitHub 不同。
|
||||
2026-04-05 ogt: 修正為純 hex 格式
|
||||
"""
|
||||
return hmac.new(
|
||||
secret.encode(),
|
||||
body,
|
||||
hashlib.sha256,
|
||||
).hexdigest()
|
||||
return f"sha256={signature}"
|
||||
|
||||
|
||||
def prepare_request(secret: str, payload: dict) -> tuple[bytes, str]:
|
||||
|
||||
Reference in New Issue
Block a user