]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.10] 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>
Thu, 29 Mar 2018 06:09:08 +0000 (06:09 +0000)
commit67582b166982cc942f3000509797358cd723dfa0
treed0df65bfa93eb954e5bb0648dc9d1e7f1f258dff
parenteef2fd28ca7023be3a3f1c62039c2643bffac948
[release-branch.go1.10] 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>
Reviewed-on: https://go-review.googlesource.com/103218
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/pprof/pprof.go
src/net/http/pprof/pprof_test.go [new file with mode: 0644]