Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed issue 574: security exposure of TALES namespaces
- Loading branch information
Christian Theune
committed
Aug 15, 2006
1 parent
48c5509
commit 4d637e1
Showing
3 changed files
with
151 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<configure xmlns="http://namespaces.zope.org/zope"> | ||
|
||
<class class=".viewpagetemplatefile.BoundPageTemplate"> | ||
<allow attributes="__call__ __str__ __name__" /> | ||
</class> | ||
|
||
<adapter | ||
for="*" | ||
provides="zope.traversing.interfaces.IPathAdapter" | ||
factory=".talesapi.ZopeTalesAPI" | ||
name="zope" | ||
/> | ||
|
||
<class class=".talesapi.ZopeTalesAPI"> | ||
<allow interface="zope.tales.interfaces.ITALESFunctionNamespace"/> | ||
<allow attributes="title description created modified name title_or_name size"/> | ||
</class> | ||
|
||
<adapter | ||
for="*" | ||
provides="zope.traversing.interfaces.IPathAdapter" | ||
factory=".urlquote.URLQuote" | ||
name="url"/> | ||
|
||
<class class=".urlquote.URLQuote"> | ||
<allow attributes="quote quote_plus unquote unquote_plus"/> | ||
</class> | ||
|
||
<class class="zope.tales.tales.Iterator"> | ||
<allow interface="zope.tales.interfaces.ITALESIterator" /> | ||
</class> | ||
|
||
<class class=".engine.ZopePathExpr"> | ||
<allow attributes="__call__" /> | ||
</class> | ||
<class class=".engine.TrustedZopePathExpr"> | ||
<allow attributes="__call__" /> | ||
</class> | ||
<class class=".engine.ZopePythonExpr"> | ||
<allow attributes="__call__" /> | ||
</class> | ||
<class class=".engine.PythonExpr"> | ||
<allow attributes="__call__" /> | ||
</class> | ||
|
||
<class class="zope.tales.expressions.StringExpr"> | ||
<allow attributes="__call__" /> | ||
</class> | ||
<class class="zope.tales.expressions.NotExpr"> | ||
<allow attributes="__call__" /> | ||
</class> | ||
<class class="zope.tales.expressions.DeferExpr"> | ||
<allow attributes="__call__" /> | ||
</class> | ||
|
||
<adapter | ||
for="zope.app.pagetemplate.viewpagetemplatefile.BoundPageTemplate | ||
zope.publisher.interfaces.browser.IBrowserRequest" | ||
provides="zope.publisher.interfaces.browser.IBrowserPublisher" | ||
factory="zope.app.publication.traversers.NoTraverser" | ||
/> | ||
|
||
</configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2004-2006 Zope Corporation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Doc tests for the pagetemplate's 'engine' module | ||
$Id$ | ||
""" | ||
import unittest | ||
from zope.testing.doctestunit import DocTestSuite | ||
|
||
import zope.component | ||
from zope.app.pagetemplate.engine import _Engine | ||
from zope.proxy import isProxy | ||
from zope.traversing.interfaces import IPathAdapter | ||
|
||
class DummyNamespace(object): | ||
|
||
def __init__(self, context): | ||
self.context = context | ||
|
||
class EngineTests(unittest.TestCase): | ||
|
||
def setUp(self): | ||
gsm = zope.component.getGlobalSiteManager() | ||
gsm.registerAdapter(DummyNamespace, required=(), provided=IPathAdapter, name='test') | ||
|
||
def tearDown(self): | ||
gsm = zope.component.getGlobalSiteManager() | ||
gsm.unregisterAdapter(DummyNamespace, required=(), provided=IPathAdapter, name='test') | ||
|
||
def test_issue574(self): | ||
engine = _Engine() | ||
namespace = engine.getFunctionNamespace('test') | ||
self.failUnless(isProxy(namespace)) | ||
|
||
|
||
def test_suite(): | ||
suite = unittest.TestSuite() | ||
suite.addTest(DocTestSuite('zope.app.pagetemplate.engine')) | ||
suite.addTest(unittest.makeSuite(EngineTests)) | ||
return suite | ||
|
||
if __name__ == '__main__': | ||
unittest.main(defaultTest='test_suite') | ||
|