How to prevent web access to specific folder ?
In my application built on top of Zope, there is a folder scripts/ which contains various python scripts. Some of these scrips invoke SQL methods and accept parameters. The DTML method (outside the scripts/ folder) calls first scripts to set parameters and then scripts which invoke SQL methods passing correct parameters. However, if users can call directly scripts with HTTP request to zope, they can pass any parameters they like. So, for security reasons it is important to deny "direct" access to scripts/ folder. Also, manager should be able to normally manage this folder from ZMI. I know this can be done by restricting View/Access Contents information privileges for folders/scripts to the specific role and then giving DTML methods proxy role. But, is there any other easier methods ? I've tried using access_rule, but the is to allow ZMI to work. At the time when access_rule is called user is not authenticated, so I cannot check if the current user is manager on not. If anybody has any ideas, I'll be gratefull, Vladimir
Vladimir Petrovic wrote:
I know this can be done by restricting View/Access Contents information privileges for folders/scripts to the specific role and then giving DTML methods proxy role. But, is there any other easier methods ?
That is the only sane way to do it..
I've tried using access_rule, but the is to allow ZMI to work. At the time when access_rule is called user is not authenticated, so I cannot check if the current user is manager on not.
You might try something clunky with a rewrite rule on your front end proxy server, but I wouldn't trust that... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Vladimir Petrovic wrote at 2005-10-6 17:44 +0300:
... restricting Web Publishing in specific folders ... I know this can be done by restricting View/Access Contents information privileges for folders/scripts to the specific role and then giving DTML methods proxy role. But, is there any other easier methods ?
There may be several alternative options: * an "AccessRule" Two potential problems: - they can be deactivated by the incomming request (but you can comment out the deactivating code) - authentication has not yet taken place; the user identity is not yet known * a "Post-Authentication-Hook" I think (but I am not sure) that Zope 2.8 has implemented them. If not, my Zope page contains a patch (for older Zope versions, will not work out of the box for Zope 2.8) for a "Post-Authentication-Hook" implementation. <http://www.dieter.handshake.de/pyprojects/zope> -- Dieter
participants (3)
-
Chris Withers -
Dieter Maurer -
Vladimir Petrovic