AccessRules can't safely be used for security

Bug #142878 reported by Jamie Heilman
2
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
High
Tres Seaver

Bug Description

Because anybody can use the _SUPPRESS_ACCESSRULE traversal hack to turn
off AccessRules they aren't safe to use for security. My concern is,
given the name of the object, that people will use it incorrectly.
Seeing as there really isn't any value in letting anonymouse users
disable AccessRules on a whim, I think the traversal hack should be
removed entirely. The environment variable disabling semaphore is safer.

@@
     def __call__(self, container, request):
         if SUPPRESS_ACCESSRULE: return
- if '_SUPPRESS_ACCESSRULE' in _swallow(request, '_SUPPRESS'):
- request.setVirtualRoot(request.steps)
- return
         NameCaller.__call__(self, container, request)

-def _swallow(request, prefix):
- path = request['TraversalRequestNameStack']
- steps = request.steps
- i = len(steps)
- while i > 0 and steps[i - 1][:1] == '_':
- i = i - 1
- while path and path[-1][:len(prefix)] == prefix:
- steps.append(path.pop())
- return steps[i:]
-
 def manage_addAccessRule(self, method_id=None, REQUEST=None, **ignored):
     """Point a __before_traverse__ entry at the specified method"""
     # We want the original object, not stuff in between, and no acquisition

Revision history for this message
Tres Seaver (tseaver) wrote :

I agree that stripping out the URL-based suppression is the right thing to do here.

We also need to rip out the equivalent code inside Products.SiteAccess.SiteRoot.

Changed in zope2:
assignee: nobody → Tres Seaver (tseaver)
importance: Medium → High
status: New → Confirmed
Revision history for this message
Jürgen Herrmann (xlhost) wrote :

+1, rip it out.

Tres Seaver (tseaver)
Changed in zope2:
status: Confirmed → In Progress
Revision history for this message
Tres Seaver (tseaver) wrote :

Fix committed to the 2.12 branch and the trunk.

Changed in zope2:
milestone: none → 2.12.7
status: In Progress → Fix Committed
Changed in zope2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.