]> Cypherpunks repositories - gostls13.git/commit
net/url: add urlmaxqueryparams GODEBUG to limit the number of query parameters
authorDamien Neil <dneil@google.com>
Mon, 3 Nov 2025 22:28:47 +0000 (14:28 -0800)
committerGopher Robot <gobot@golang.org>
Thu, 15 Jan 2026 18:35:53 +0000 (10:35 -0800)
commit2dcaaa751295597e1f603b7488c4624db6a84d2b
tree63e8806c6b1b1b50c2816071b4ba6ecdf24d454e
parent5e1ad12db93611b13d2be176fdc276330dc52b98
net/url: add urlmaxqueryparams GODEBUG to limit the number of query parameters

net/url does not currently limit the number of query parameters parsed by
url.ParseQuery or URL.Query.

When parsing a application/x-www-form-urlencoded form,
net/http.Request.ParseForm will parse up to 10 MB of query parameters.
An input consisting of a large number of small, unique parameters can
cause excessive memory consumption.

We now limit the number of query parameters parsed to 10000 by default.
The limit can be adjusted by setting GODEBUG=urlmaxqueryparams=<n>.
Setting urlmaxqueryparams to 0 disables the limit.

Thanks to jub0bs for reporting this issue.

Fixes #77101
Fixes CVE-2025-61726

Change-Id: Iee3374c7ee2d8586dbf158536d3ade424203ff66
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3020
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736712
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
doc/godebug.md
src/internal/godebugs/table.go
src/net/url/url.go
src/net/url/url_test.go
src/runtime/metrics/doc.go