Skip to content

fastcgi: fail the request when a param name cannot fit in a record - #8342

Open
BenMacha wants to merge 3 commits into
caddyserver:masterfrom
BenMacha:fastcgi-reject-long-param-name
Open

BenMacha wants to merge 3 commits into
caddyserver:masterfrom
BenMacha:fastcgi-reject-long-param-name

Conversation

@BenMacha

@BenMacha BenMacha commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #8321, reworked as suggested by @steadytao: instead of dropping the param, the request now fails.

A name longer than maxWrite-8 bytes made the value truncation length negative and panicked when slicing. writePairs now returns an error in that case, so the request is never forwarded with a partial set of params. Oversized values keep being truncated as before.

Assistance Disclosure

The bug was found during a code review done with Claude Code (Anthropic), which also drafted the fix and the tests. I reviewed the change, can explain every line, and ran go test -race -short on the affected package before opening this PR.

A name longer than maxWrite-8 bytes made the value truncation length
negative and panicked when slicing. Return an error instead of
forwarding a partial set of params.
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.

2 participants