]> Cypherpunks repositories - gostls13.git/commit
net/http: set nosniff header when serving Error
authorAndrew Gerrand <adg@golang.org>
Tue, 2 Jun 2015 18:01:56 +0000 (11:01 -0700)
committerAndrew Gerrand <adg@golang.org>
Tue, 2 Jun 2015 18:29:45 +0000 (18:29 +0000)
commit321663197e57ea5cea704b337cb8185f33883bd0
treeaec7305a5d6af44ec7d1fdf6aeeaa11199491ef6
parent70cf7352b488f68141cf73ba35cdfe7c158964fd
net/http: set nosniff header when serving Error

The Error function is a potential XSS vector if a user can control the
error message.

For example, an http.FileServer when given a request for this path
/<script>alert("xss!")</script>
may return a response with a body like this
open <script>alert("xss!")</script>: no such file or directory
Browsers that sniff the content may interpret this as HTML and execute
the script. The nosniff header added by this CL should help, but we
should also try santizing the output entirely.

Change-Id: I447f701531329a2fc8ffee2df2f8fa69d546f893
Reviewed-on: https://go-review.googlesource.com/10640
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/server.go