fix(line): add request body size limit to webhook handler to prevent DoS#1428
Closed
darrenzeng2025 wants to merge 1 commit intosipeed:mainfrom
Closed
fix(line): add request body size limit to webhook handler to prevent DoS#1428darrenzeng2025 wants to merge 1 commit intosipeed:mainfrom
darrenzeng2025 wants to merge 1 commit intosipeed:mainfrom
Conversation
- Add MaxWebhookBodySize constant (1MB) for LINE webhook requests - Use http.MaxBytesReader to limit request body size - Return 413 status code when request body exceeds limit Fixes sipeed#1407
76279fb to
f64ad75
Compare
xuwei-xy
pushed a commit
to xuwei-xy/picoclaw
that referenced
this pull request
Mar 14, 2026
Collaborator
关闭原因此 PR 的功能已被 #1413 覆盖。 问题分析
建议如果仍想用
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复 LINE webhook handler 中的 DoS 安全风险 (Issue #1407)
Problem
LINE webhook handler 使用
io.ReadAll读取请求体,没有应用MaxBytesReader或任何显式大小限制,允许远程内存耗尽攻击。Solution
MaxWebhookBodySize常量(1MB)限制请求体大小http.MaxBytesReader在读取前限制请求体大小Changes
pkg/channels/line/line.go: 在webhookHandler中添加请求体大小限制Testing
Fixes #1407