Commit 578139ba authored by Tres Seaver's avatar Tres Seaver

Prevent arbitrary redirections via faked "CANCEL" buttons.

Fixes LP #1094144.
parent b249b0dd
......@@ -8,6 +8,8 @@ http://docs.zope.org/zope2/
2.12.28 (unreleased)
--------------------
- LP #1094144: prevent arbitrary redirections via faked "CANCEL" buttons.
- LP #1094221: add permissions to some unprotected methods of
``OFS.ObjectManager``
......
......@@ -10,12 +10,13 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
__doc__="""Python Object Publisher -- Publish Python objects on web servers
$Id$"""
import sys, os
"""Python Object Publisher -- Publish Python objects on web servers
"""
import os
import sys
import transaction
from urlparse import urlparse
from Response import Response
from Request import Request
from maybe_lock import allocate_lock
......@@ -90,8 +91,18 @@ def publish(request, module_name, after_list, debug=0,
response=request.response
# First check for "cancel" redirect:
if request_get('SUBMIT','').strip().lower()=='cancel':
cancel=request_get('CANCEL_ACTION','')
if request_get('SUBMIT', '').strip().lower() == 'cancel':
cancel = request_get('CANCEL_ACTION', '')
if cancel:
# Relative URLs aren't part of the spec, but are accepted by
# some browsers.
for part, base in zip(urlparse(cancel)[:3],
urlparse(request['BASE1'])[:3]):
if not part:
continue
if not part.startswith(base):
cancel = ''
break
if cancel:
raise Redirect, cancel
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment