Skip to content

Remove HTTP Host header entirely#1672

Merged
zachmargolis merged 1 commit intomasterfrom
margolis-host-headers
Sep 14, 2017
Merged

Remove HTTP Host header entirely#1672
zachmargolis merged 1 commit intomasterfrom
margolis-host-headers

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
event.payload.except(:params, :headers)
end

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

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
Contributor

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