aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-11-03 14:28:47 -0800
committerGopher Robot <gobot@golang.org>2026-01-15 10:35:53 -0800
commit2dcaaa751295597e1f603b7488c4624db6a84d2b (patch)
tree63e8806c6b1b1b50c2816071b4ba6ecdf24d454e /src/runtime
parent5e1ad12db93611b13d2be176fdc276330dc52b98 (diff)
downloadgo-2dcaaa751295597e1f603b7488c4624db6a84d2b.tar.xz
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>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/metrics/doc.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go
index ca032f51b1..6b774c36f3 100644
--- a/src/runtime/metrics/doc.go
+++ b/src/runtime/metrics/doc.go
@@ -404,6 +404,11 @@ Below is the full list of supported metrics, ordered lexicographically.
The number of non-default behaviors executed by the runtime
package due to a non-default GODEBUG=updatemaxprocs=... setting.
+ /godebug/non-default-behavior/urlmaxqueryparams:events
+ The number of non-default behaviors executed by the net/url
+ package due to a non-default GODEBUG=urlmaxqueryparams=...
+ setting.
+
/godebug/non-default-behavior/urlstrictcolons:events
The number of non-default behaviors executed by the net/url
package due to a non-default GODEBUG=urlstrictcolons=...