[Zope3-dev] Bug or Feature in security proxy / checker code?

Christian Theune ct at gocept.com
Thu Jan 12 11:19:56 EST 2006


we are wondering about the behaviour in the following situation:

* self is a view and we're in a method of that view

* self.context is an instance of class A 
  (A is a content class and a folder)

* self.context is security proxied

* class A has a method doStuff

* we call self.context.doStuff()

* in doStuff, self is not proxied

* accessing other things through self[id] in doStuff does not give a
  proxied object

Result: code can perform operations that users normally could not do,
without anybody calling "removeAllProxies" explicitly.

Is this intentional? I'm not sure about that. I feel like those calls
should work with proxied objects as well.


PS: It seems that the _zope_security_proxy.c code and the corresponding
Python code are a little bit out of sync. The C-code does a little bit
more that isn't in the python code anymore. See this patch:

--- checker.py  (Revision 41246)
+++ checker.py  (Arbeitskopie)
@@ -371,6 +371,9 @@
     if checker is NoProxy:
         return None

+    if checker is _defaultChecker and isinstance(object, Exception):
+        return None
     while not isinstance(checker, Checker):
         checker = checker(object)
         if checker is NoProxy or checker is None:

As stated in _zope_security_proxy.c line 495:

/*     if checker is _defaultChecker and isinstance(object, Exception):
/*         return None */

  if (checker == _defaultChecker
      && PyObject_IsInstance(object, PyExc_Exception))
      return Py_None;

gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20060112/69e95e91/attachment.bin

More information about the Zope3-dev mailing list