Skip to content

fix(request): refuse a query string past max_input_vars with 400 instead of cutting it (#413) - #431

Merged
EdmondDantes merged 1 commit into
mainfrom
fix/413-query-max-input-vars
Oct 20, 2026
Merged

EdmondDantes merged 1 commit into
mainfrom
fix/413-query-max-input-vars

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

Fixes #413.

getQuery() kept the first max_input_vars pairs and dropped the rest without a word, and dropped a name nested past max_input_nesting_level the same way; a form body over the same limits is refused with 400. Decision (Edmond, 2026-10-20): refuse the query string the same way.

  • http_request_ensure_uri_parsed records the refusal (query_refused_reason, a new field of http_request_t); the path is still parsed.
  • getQuery() and getQueryParam() throw HttpException 400 "the query string was refused: " on every call; uncaught, dispose answers 400. getPath() is unaffected.
  • Docblocks of both getters (stub and ide-stubs) and a CHANGELOG Changed entry.

Tests: h1/074 answers 200 with three of four pairs on main and 400 after. http1parser/017 and 018 asserted the cut and now assert the refusal.

Local (ZTS DEBUG): full phpt 636 passed, 2 skipped in three runs; an earlier run before them had one failure whose test I did not capture, and it did not recur. cmocka 24 of 24.

Also: dev/PLAN.md records #413, and the #329 trace (Linux wakes the last-registered epoll first on a shared listening socket; comment on #329).

@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Total lines: 85.93% → 85.95% (+0.02 pp)

File Baseline Current Δ Touched
src/http2/http2_strategy.c 86.15% 86.18% +0.03 pp
src/http3/http3_callbacks.c 86.88% 86.87% -0.01 pp
src/http3/http3_dispatch.c 90.94% 91.08% +0.13 pp
src/http3/http3_listener.c 78.93% 80.06% +1.12 pp
src/http_form_vars.c 90.32% 91.94% +1.61 pp
src/http_request.c 90.10% 90.20% +0.11 pp ●
src/http_server_class.c 79.37% 79.04% -0.32 pp

@EdmondDantes
EdmondDantes merged commit 7685c12 into main Oct 20, 2026
8 checks passed
@EdmondDantes
EdmondDantes deleted the fix/413-query-max-input-vars branch October 20, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getQuery() silently drops pairs past max_input_vars; the body refuses with 400

1 participant