Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent HTML reflection vulnerability in 500 error status handler #142

Merged
merged 1 commit into from
May 7, 2015

Conversation

jre-g
Copy link
Contributor

@jre-g jre-g commented Apr 30, 2015

Certain IO errors containing the requested path can be echoed directly back to the user without a Content-Type header. In some cases, browsers' sniffing can result in the document being treated as HTML, allowing XSS. This is resolved by sending a Content-Type header of text/plain.

Includes a test case that can reproduce this behaviour, at least on some Linux systems. (The test should simply pass on other systems.) You can observe this test failing as expected after an intentional regression in this Travis build.

Certain IO errors containing the requested filename could be directly echoed back to the user without a Content-Type header. In some cases, browser sniffing could result in this document being treated as HTML, allowing XSS. This is resolved by sending the Content-Type header of text/plain.

Includes a test case that can reproduce this behaviour on at least some Linux systems.
@jre-g jre-g closed this May 6, 2015
@jre-g jre-g deleted the reflection branch May 6, 2015 23:16
@jfhbrook
Copy link
Owner

jfhbrook commented May 6, 2015

Just because I didn't merge this, doesn't mean I'm disinterested. I just hadn't gotten around to it.

@jre-g jre-g restored the reflection branch May 6, 2015 23:49
@jre-g
Copy link
Contributor Author

jre-g commented May 6, 2015

Oops! I'm very sorry. I didn't intend to close this, or realize that I had. I was trying out a new Git client, and must have done something silly.

@jre-g jre-g reopened this May 6, 2015
@jfhbrook
Copy link
Owner

jfhbrook commented May 6, 2015

All good! I'll try to merge this tonight.

@jfhbrook
Copy link
Owner

jfhbrook commented May 7, 2015

So I think this is a sane PR and I want to merge it, but I'm really trying to get my browser to throw up an alert and it's just not havin' it. Any hints? I'd love to be able to before/after this before clicking the magic green button.

@jre-g
Copy link
Contributor Author

jre-g commented May 7, 2015

I've just emailed you an example that should work. I didn't include one here because, though it probably won't make much of a difference, I didn't want to make things easier for anybody who might try to exploit this.

@jfhbrook
Copy link
Owner

jfhbrook commented May 7, 2015

Beautiful. <3

@jfhbrook jfhbrook merged commit af75502 into jfhbrook:master May 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants