]> Cypherpunks repositories - gostls13.git/commit
net/http/pprof: harden handler responses
authorAndrew Bonventre <andybons@golang.org>
Fri, 23 Mar 2018 20:40:15 +0000 (16:40 -0400)
committerAndrew Bonventre <andybons@golang.org>
Wed, 28 Mar 2018 21:52:33 +0000 (21:52 +0000)
commitbaa46bcf5b532a8f6d6684af8c0e500ce4cd41d2
tree68a19daf6c75cf1bec2631b852ef0cc8df920286
parent70afd51ec53095727989f64365fb342082f06832
net/http/pprof: harden handler responses

A very small number of old browsers consider content as HTML
even when it is explicitly stated in the Content-Type header
that it is not. If content served is based on user-supplied
input, then an XSS is possible. Introduce three mitigations:

+ Don't reflect user input in error strings
+ Set a Content-Disposition header when requesting a resource
  that should never be displayed in a browser window
+ Set X-Content-Type-Options: nosniff on all responses

Change-Id: I81c9d6736e0439ebd1db99cd7fb701cc56d24805
Reviewed-on: https://go-review.googlesource.com/102318
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/pprof/pprof.go
src/net/http/pprof/pprof_test.go [new file with mode: 0644]