Skip to content

fix(wecom): pad base64 AES key before decode (salvage #17040) - #20177

Merged
teknium1 merged 2 commits into
mainfrom
salvage/pr-17040
May 5, 2026
Merged

fix(wecom): pad base64 AES key before decode (salvage #17040)#20177
teknium1 merged 2 commits into
mainfrom
salvage/pr-17040

Conversation

@teknium1

@teknium1 teknium1 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Salvages the AES padding fix from @chengoak's PR #17040. The SSRF whitelist entry for a contributor-specific COS bucket hostname (ww-aibot-img-1258476243.cos.ap-guangzhou.myqcloud.com, which looks like a private tenant ID baked into the repo) was dropped as it belongs in user config, not the built-in list. The INFO-level debug log of full message bodies was also dropped.

What it does

WeCom doesn't pad base64 aeskey; Python's strict decoder rejects the unpadded key, so every media/image/file webhook fails to decrypt.

Changes

  • gateway/platforms/wecom.py — pad aes_key to a multiple of 4 before base64.b64decode.
  • scripts/release.py — AUTHOR_MAP entry for chengoak.

Validation

py_compile clean. Minimal change, 2 lines.

Closes #17040 via salvage.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/wecom WeCom / WeChat Work adapter labels May 5, 2026
@teknium1
teknium1 force-pushed the salvage/pr-17040 branch from f4e6fed to cef07d2 Compare May 5, 2026 11:45
chengoak and others added 2 commits May 5, 2026 05:00
WeCom doesn't pad base64 aeskey, causing Python strict mode decode failure
on media/image/file messages. Add automatic padding before base64 decode:
aes_key + '=' * ((4 - len(aes_key) % 4) % 4).

Salvages the AES padding fix from @chengoak's PR #17040. The SSRF whitelist
entry for a private COS bucket hostname was dropped as it belongs in user
config, not the built-in trusted-private-IP-hosts list. The debug-level
full-body info log was dropped to avoid logging potentially sensitive
message content at INFO level.
@teknium1
teknium1 force-pushed the salvage/pr-17040 branch from cef07d2 to fca8f25 Compare May 5, 2026 12:00
@teknium1
teknium1 merged commit 046c293 into main May 5, 2026
9 of 10 checks passed
@teknium1
teknium1 deleted the salvage/pr-17040 branch May 5, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/wecom WeCom / WeChat Work adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants