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

Remove HTTP Host header entirely #1672

Merged
merged 1 commit into from
Sep 14, 2017
Merged

Conversation

zachmargolis
Copy link
Contributor

Why: Malformed host headers cause exceptions

--

I basically rewrote the middleware gem we added in #1663 because that gem only delete a particular 5 headers, not including HTTP_HOST so in order to delete that I had to get around it

I would be open to removing the dependency entirely, but this seemed like an easier way to just re-use the list of headers we don't trust

@zachmargolis zachmargolis self-assigned this Sep 14, 2017
@zachmargolis zachmargolis force-pushed the margolis-host-headers branch 2 times, most recently from c565a14 to b43c871 Compare September 14, 2017 18:33
**Why**: Malformed host headers cause exceptions
@@ -33,7 +33,8 @@ class Application < Rails::Application
event.payload.except(:params, :headers)
end

config.middleware.insert_before 0, Rack::HeadersFilter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the rack-header-filter gem let's you call this with a blacklist. Why not do that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh thanks, I'd missed that gem entirely, will update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so that gem deletes outgoing headers, not incoming headers, I don't think we can use it here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frown town. Oh well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extremely frown town 😿

@zachmargolis zachmargolis merged commit 1f6afcd into master Sep 14, 2017
@zachmargolis zachmargolis deleted the margolis-host-headers branch September 14, 2017 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants