in_http: urlencoded parser ignores body length, absorbs pipelined requests
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- c
- Área
- backend, networking
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C
- Estrellas
- 8.2k
- Forks
- 2k
- Merge medio
- 3 d 20 h
- PR fusionados (30 d)
- 99
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de fluent/fluent-bit
-
in_tail: files falsely detected as rotated on macOS with threaded inputs, causing duplicate recordsPosiblemente ocupada @kevin9327 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
fluent/fluent-bit#12780 ·
Los mantenedores suelen responder en 1 día
-
status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
fluent/fluent-bit#12683 · 2 comentarios · 6 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
fluent/fluent-bit#12657 ·
Los mantenedores suelen responder en 1 día
-
http: Transfer-Encoding chunked plus Content-Length hangs forever (CL branch shadows the chunked path)Posiblemente ocupada @sarankumar1325 la tomó hace 14 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
fluent/fluent-bit#12656 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
fluent/fluent-bit#12649 ·
Los mantenedores suelen responder en 1 día
Todos los issues de fluent/fluent-bit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
ChupathingyCE/chupathingyce#1128 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
php/pecl-networking-ssh2#111 ·
-
.contrib/good first issue area:languages/c++ reach:some users severity:S3
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
zed-industries/zed#66889 ·
Los mantenedores suelen responder en 1 día
-
bug impact medium likelihood medium
Dificultad 1/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
shinyquagsire23/OpenJKDF2#528 ·
Los mantenedores suelen responder en 2 días