fix(gateway): harden WeCom callback against XML DoS and XXE - #8686
Conversation
|
Independent audit confirms the underlying issue this PR is addressing. Two validation notes that may help review:
One nuance: this endpoint is running under aiohttp, whose default |
|
merge conflicts This PR does not merge cleanly with the base branch. Please rebase or merge current Signed: GPT-5.5-low in Codex |
Related to #10192 / #28585 / #35413 (competing WeCom callback XML-hardening PRs). Note: the core XXE/billion-laughs protection already landed on |
|
Thanks for the security hardening work. This is an automated hermes-sweeper review; the reported protection is already implemented on current
Closing as implemented on main. |
Summary
This PR hardens the WeCom callback endpoint against XML-based Denial of Service (DoS) and XML External Entity (XXE) attacks.
Why
The previous implementation directly parsed raw callback XML using
ElementTreebefore validation. This exposed a vulnerability where large payloads or maliciousDOCTYPE/ENTITYdefinitions could lead to resource exhaustion or information leakage.Changes
Encryptfield, avoiding full XML parsing for raw messages.DOCTYPEorENTITYtags before they reach the parser.Verification
Added comprehensive security tests in
tests/gateway/test_wecom_callback.py: