Add Morepath framework to Python#2903
Add Morepath framework to Python#2903NateBrady23 merged 1 commit intoTechEmpower:masterfrom henri-hulski:add_morepath
Conversation
|
Added some local tests similar to Pyramid which are passing after fixing some stuff. |
|
@henri-hulski What were the changes that were made? It doesn't look like any other python frameworks are having an issue with travis. This looks like a server configuration issue. |
|
Morepath does some Header checks to avoid the most basic host header poisoning attacts. Here the Morepath check: @App.tween_factory(over=excview_tween_factory)
def poisoned_host_header_protection_tween_factory(app, handler):
"""Protect Morepath applications against the most basic host header
poisoning attacts.
The regex approach has been copied from the Django project. To find more
about this particular kind of attack have a look at the following
references:
* http://skeletonscribe.net/2013/05/practical-http-host-header-attacks
* https://www.djangoproject.com/weblog/2012/dec/10/security/
* https://github.com/django/django/commit/77b06e41516d8136b56c040cba7e235b
"""
valid_host_re = re.compile(
r"^([a-z0-9.-]+|\[[a-f0-9]*:[a-f0-9:]+\])(:\d+)?$")
def poisoned_host_header_protection_tween(request):
if not valid_host_re.match(request.host):
return HTTPBadRequest("Invalid HOST header")
return handler(request)
return poisoned_host_header_protection_tween |
|
@nbrady-techempower How does the request host header looks like which FrameworkBenchmark is sending? |
|
Ok seems to be a bug in Morepath. It didn't accept upper-case Host header. |
|
Fixed in what |
|
Yeah I think I will release tonight. I have also fixed some issues which came up in vagrant. |
|
I have updated the PR and Travis Morepath tests are passing. So I think it's ready for review. |
|
When running the plaintext benchmark for morepath in vagrant I get And ten thousands of BrokenPipeErrors. Rerun it several times and always the same. All other benchmarks are running fine. |
|
Is this related to my environment (vagrant on a not too fast laptop) or is here something wrong? |
|
Ok. When trying to run the plaintext benchmark for Pyramid and Flask I get the same errors. So seems to be related to my machine. In this case the PR should be ready. |
No description provided.