in_http: urlencoded parser ignores body length, absorbs pipelined requests
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- backend, networking
Hướng nghiên cứu
Start with parse_payload_urlencoded() in plugins/in_http/http_prot.c and trace how the caller passes the payload and its length. Check the HTTP input tests for urlencoded bodies and pipelined requests, then add coverage showing parsing stops at Content-Length. Done means trailing bytes stay out of the parsed value and a following request is processed.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Report
Describe the bug
The application/x-www-form-urlencoded parser in the http input ignores the request body length and consumes
everything up to the NUL terminator of the body buffer. Bytes after Content-Length — including a following
pipelined request — are absorbed into the last field's value, and the pipelined request is then never
processed.
To Reproduce
Start an http input on port 9880, then send one connection with a body shorter than the bytes that follow:
POST /one HTTP/1.1
Host: x
Content-Type: application/x-www-form-urlencoded
Content-Length: 3
a=1POST /two HTTP/1.1
Host: x
Content-Type: application/x-www-form-urlencoded
Content-Length: 3
b=2
Observed on stdout:
[0] one: [[..., {}], {"a"=>"1POST /two HTTP/1.1
Host: x
Content-Type: application/x-www-form-urlencoded
Content-Length: 3
b=2"}]
Only one record is produced, tagged one. The second request is swallowed entirely, and the connection
then times out instead of answering it.
Even without pipelining it is wrong — Content-Length: 3 with body a=1 followed by ZZZ=9 yields
{"a"=>"1ZZZ=9"}.
Root cause
plugins/in_http/http_prot.c, parse_payload_urlencoded():
kvs = flb_utils_split(payload, '&', -1 );
flb_utils_split() takes no length and is NUL-terminated-string based, so it runs to the end of the body
buffer rather than to size. The function receives size from its caller —
ret = parse_payload_urlencoded(ctx, &encoder, tag, payload,
cfl_sds_len(payload), request);
— but never uses it.
Expected behavior
Parsing should stop at size (e.g. a length-aware split, or a temporary NUL at payload[size]), so trailing
bytes and pipelined requests are not absorbed.
Your Environment
- Fluent Bit 5.1.5 (
fluent/fluent-bit:latest); the function is byte-identical on currentmaster - Linux, aarch64, official container image
- Input:
httpplugin, default settings,Content-Type: application/x-www-form-urlencoded
Impact
Pre-auth record corruption, and any pipelined request following a urlencoded POST is silently dropped. Also
makes the declared Content-Length meaningless for this content type.
- Ngôn ngữ chính
- C
- Star
- 8.2k
- Fork
- 2k
- Merge trung bình
- 3 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 99
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fluent/fluent-bit
-
in_tail: files falsely detected as rotated on macOS with threaded inputs, causing duplicate recordsCó thể đã có người làm @kevin9327 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
fluent/fluent-bit#12780 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status: waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fluent/fluent-bit#12683 · 2 bình luận · 6 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
fluent/fluent-bit#12657 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
http: Transfer-Encoding chunked plus Content-Length hangs forever (CL branch shadows the chunked path)Có thể đã có người làm @sarankumar1325 đã nhận 14 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fluent/fluent-bit#12656 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
fluent/fluent-bit#12649 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fluent/fluent-bit
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
FujiNetWIFI/fujinet-firmware#2365 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
ChupathingyCE/chupathingyce#1128 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
php/pecl-networking-ssh2#111 ·