Skip to content

Commit 5c7c20e

Browse files
mknyszekgopherbot
authored andcommitted
[release-branch.go1.20] html/template,mime/multipart: document new GODEBUG settings
This change documents the new GODEBUG settings introduced for html/template and mime/multipart, released with Go 1.19.8 and Go 1.20.3 as part of a security fix. Updates #59153. For #59270. Updates #59234. For #59272. Change-Id: I25f4d8245da3301dccccfb44da8ff1a5985392a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/482555 TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> Reviewed-by: Damien Neil <[email protected]> Run-TryBot: Michael Knyszek <[email protected]>
1 parent 7c47a6b commit 5c7c20e

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/html/template/doc.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,12 @@ Least Surprise Property:
231231
"A developer (or code reviewer) familiar with HTML, CSS, and JavaScript, who
232232
knows that contextual autoescaping happens should be able to look at a {{.}}
233233
and correctly infer what sanitization happens."
234+
235+
As a consequence of the Least Surprise Property, template actions within an
236+
ECMAScript 6 template literal are disabled by default.
237+
Handling string interpolation within these literals is rather complex resulting
238+
in no clear safe way to support it.
239+
To re-enable template actions within ECMAScript 6 template literals, use the
240+
GODEBUG=jstmpllitinterp=1 environment variable.
234241
*/
235242
package template

src/mime/multipart/multipart.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ Package multipart implements MIME multipart parsing, as defined in RFC
99
1010
The implementation is sufficient for HTTP (RFC 2388) and the multipart
1111
bodies generated by popular browsers.
12+
13+
# Limits
14+
15+
To protect against malicious inputs, this package sets limits on the size
16+
of the MIME data it processes.
17+
18+
Reader.NextPart and Reader.NextRawPart limit the number of headers in a
19+
part to 10000 and Reader.ReadForm limits the total number of headers in all
20+
FileHeaders to 10000.
21+
These limits may be adjusted with the GODEBUG=multipartmaxheaders=<values>
22+
setting.
23+
24+
Reader.ReadForm further limits the number of parts in a form to 1000.
25+
This limit may be adjusted with the GODEBUG=multipartmaxparts=<value>
26+
setting.
1227
*/
1328
package multipart
1429

0 commit comments

Comments
 (0)