<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 13, 2016 at 9:42 AM, Thomas De Schampheleire <span dir="ltr"><<a href="mailto:patrickdepinguin@gmail.com" target="_blank">patrickdepinguin@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
><br>
> (Aside: I did not look at the tgext.routes code, but I assume the override support is opt-in? Enabling it automatically for all applications could cause security issues for applications that don't have CSRF protection.)<br>
<br>
</span>AFAIU there is no opt-in currently: the following lines were added<br>
unconditionally:<br>
<br>
# routes middleware overrides methods using _method param.<br>
if environ['REQUEST_METHOD'] == 'GET' and '_method' in state.request.GET:<br>
    environ['REQUEST_METHOD'] = state.request.GET['_method'].upper()<br>
elif environ['REQUEST_METHOD'] == 'POST' and '_method' in state.request.POST:<br>
    environ['REQUEST_METHOD'] = state.request.POST['_method'].upper()</blockquote><div><br></div><div>Nope, there is no opt-in.</div><div>There isn't in routes itself too: <a href="https://github.com/bbangert/routes/blob/master/routes/middleware.py#L61-L70">https://github.com/bbangert/routes/blob/master/routes/middleware.py#L61-L70</a></div><div><br></div><div>Also even though you would opt-out you can still perform CSRF in any case by using an XMLHTTPRequest or a form.</div></div><br></div></div>