Re: [Zope] how to prevent URL access to an external method?
Sorry, you are correct, I meant to say from restricted space. The external method is what gives me access to unrestricted python. I do plan on using Tres' method. - Original Message From: Lennart Regebro To: Pedro LaWrench Cc: Jaroslav Lukesh ; [email protected]; Tres Seaver Sent: Tuesday, April 28, 2009 11:12:20 AM Subject: Re: [Zope] how to prevent URL access to an external method? On Tue, Apr 28, 2009 at 18:25, Pedro LaWrench wrote: > > What would you change on the security tab? I still want my authenticated > users to have access to the method as a call to it is made from unrestricted > space (such as a page template) A page template is restricted. If it really was unrestricted it would be called from Python code on the hard disk, and then you wouldn't need the external method. > I just don't want them to call the method directly. So Tres method is the simplest one that does just this. -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64 ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
On Tue, Apr 28, 2009 at 18:25, Pedro LaWrench wrote: > > What would you change on the security tab? I still want my authenticated > users to have access to the method as a call to it is made from unrestricted > space (such as a page template) A page template is restricted. If it really was unrestricted it would be called from Python code on the hard disk, and then you wouldn't need the external method. > I just don't want them to call the method directly. So Tres method is the simplest one that does just this. -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64 ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
MEthod1: security allow view only for manager Method2: contain calling of method1, security: view for anonymous or role what you want for. - Original Message - From: "Pedro LaWrench" What would you change on the security tab? I still want my authenticated users to have access to the method as a call to it is made from unrestricted space (such as a page template), I just don't want them to call the method directly. - Original Message From: Jaroslav Lukesh To: [email protected]; Tres Seaver Sent: Tuesday, April 28, 2009 8:50:29 AM Subject: Re: [Zope] how to prevent URL access to an external method? Why? It is more transparent and better way - use security tab. ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
What would you change on the security tab? I still want my authenticated users to have access to the method as a call to it is made from unrestricted space (such as a page template), I just don't want them to call the method directly. - Original Message From: Jaroslav Lukesh To: [email protected]; Tres Seaver Sent: Tuesday, April 28, 2009 8:50:29 AM Subject: Re: [Zope] how to prevent URL access to an external method? Why? It is more transparent and better way - use security tab. - Original Message - From: "Tres Seaver" > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Pedro LaWrench wrote: >> I need to do something on the filesystem, which requires unrestricted >> python, so I created an external method. The problem is that anyone >> can call that directly via URL, so I added a permission check. Even >> then, users with the sufficient permissions can call this via URL, >> which I don't want them to do. I only want them to have access >> indirectly from other pages (such as a page template that will pass >> sane parameters). Is there anyway to do this? > > Add a REQUEST argument to your function, defaulting to None. The > publisher will always pass the request in for that argument, while the > other templates / scripts should not. E.g.: > > def doSomething(self, REQUEST=None): > """ Don't call me directly via a URL!!! > """ > if REQUEST is not None: > raise ValueError('Wicked, evil, naughty Zoot!') ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
In my opinion Tres's way is the correct one for this case
Why? Because the original must be is to run the script only for internal
processes
The main diference between an internal call and a user one is the REQUEST
parameter and then the Tres's solution seems the more convenient way
It's only my opinion
2009/4/28 Jaroslav Lukesh
> Why? It is more transparent and better way - use security tab.
>
>
> - Original Message -
> From: "Tres Seaver"
>
>
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > Pedro LaWrench wrote:
> >> I need to do something on the filesystem, which requires unrestricted
> >> python, so I created an external method. The problem is that anyone
> >> can call that directly via URL, so I added a permission check. Even
> >> then, users with the sufficient permissions can call this via URL,
> >> which I don't want them to do. I only want them to have access
> >> indirectly from other pages (such as a page template that will pass
> >> sane parameters). Is there anyway to do this?
> >
> > Add a REQUEST argument to your function, defaulting to None. The
> > publisher will always pass the request in for that argument, while the
> > other templates / scripts should not. E.g.:
> >
> > def doSomething(self, REQUEST=None):
> > """ Don't call me directly via a URL!!!
> > """
> > if REQUEST is not None:
> > raise ValueError('Wicked, evil, naughty Zoot!')
>
> ___
> Zope maillist - [email protected]
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
___
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
Why? It is more transparent and better way - use security tab.
- Original Message -
From: "Tres Seaver"
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Pedro LaWrench wrote:
>> I need to do something on the filesystem, which requires unrestricted
>> python, so I created an external method. The problem is that anyone
>> can call that directly via URL, so I added a permission check. Even
>> then, users with the sufficient permissions can call this via URL,
>> which I don't want them to do. I only want them to have access
>> indirectly from other pages (such as a page template that will pass
>> sane parameters). Is there anyway to do this?
>
> Add a REQUEST argument to your function, defaulting to None. The
> publisher will always pass the request in for that argument, while the
> other templates / scripts should not. E.g.:
>
> def doSomething(self, REQUEST=None):
> """ Don't call me directly via a URL!!!
> """
> if REQUEST is not None:
> raise ValueError('Wicked, evil, naughty Zoot!')
___
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
Excellent. Thank you all for the suggests. - Original Message From: Tres Seaver To: [email protected] Sent: Tuesday, April 28, 2009 8:38:18 AM Subject: Re: [Zope] how to prevent URL access to an external method? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pedro LaWrench wrote: > I need to do something on the filesystem, which requires unrestricted > python, so I created an external method. The problem is that anyone > can call that directly via URL, so I added a permission check. Even > then, users with the sufficient permissions can call this via URL, > which I don't want them to do. I only want them to have access > indirectly from other pages (such as a page template that will pass > sane parameters). Is there anyway to do this? Add a REQUEST argument to your function, defaulting to None. The publisher will always pass the request in for that argument, while the other templates / scripts should not. E.g.: def doSomething(self, REQUEST=None): """ Don't call me directly via a URL!!! """ if REQUEST is not None: raise ValueError('Wicked, evil, naughty Zoot!') Tres. - -- === Tres Seaver +1 540-429-0999 [email protected] Palladion Software "Excellence by Design" http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJ9yLq+gerLs4ltQ4RAlj1AKDG4YIkceWD8yXpz0jvxqiN8Qlw2gCbBa9E tCVUTkjoRIPL8YjSzFHY528= =QbiL -END PGP SIGNATURE- ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Pedro LaWrench wrote:
> I need to do something on the filesystem, which requires unrestricted
> python, so I created an external method. The problem is that anyone
> can call that directly via URL, so I added a permission check. Even
> then, users with the sufficient permissions can call this via URL,
> which I don't want them to do. I only want them to have access
> indirectly from other pages (such as a page template that will pass
> sane parameters). Is there anyway to do this?
Add a REQUEST argument to your function, defaulting to None. The
publisher will always pass the request in for that argument, while the
other templates / scripts should not. E.g.:
def doSomething(self, REQUEST=None):
""" Don't call me directly via a URL!!!
"""
if REQUEST is not None:
raise ValueError('Wicked, evil, naughty Zoot!')
Tres.
- --
===
Tres Seaver +1 540-429-0999 [email protected]
Palladion Software "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJ9yLq+gerLs4ltQ4RAlj1AKDG4YIkceWD8yXpz0jvxqiN8Qlw2gCbBa9E
tCVUTkjoRIPL8YjSzFHY528=
=QbiL
-END PGP SIGNATURE-
___
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
I like this idea. Is this a standard approach in the Zope world? Surely this is a relatively common problem...at least it seems to me that the intention of external methods is to provide support routines with unrestricted python that are never meant to be called directly by users. Or are external methods the wrong way to do this? - Original Message From: Jonathan (dev101) To: Pedro LaWrench ; [email protected] Sent: Tuesday, April 28, 2009 8:08:03 AM Subject: Re: [Zope] how to prevent URL access to an external method? Within the ExternalMethod you could check the ACTUAL_URL variable (in REQUEST) and if the name of the external method is found you could redirect the user to a "you're a baaad user" page. Jonathan - Original Message - From: "Pedro LaWrench" To: Sent: Tuesday, April 28, 2009 11:04 AM Subject: [Zope] how to prevent URL access to an external method? I need to do something on the filesystem, which requires unrestricted python, so I created an external method. The problem is that anyone can call that directly via URL, so I added a permission check. Even then, users with the sufficient permissions can call this via URL, which I don't want them to do. I only want them to have access indirectly from other pages (such as a page template that will pass sane parameters). Is there anyway to do this? Thanks, PL ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.12.6/2084 - Release Date: 04/28/09 06:15:00 ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
I don't know what this means. BTW, I'm using Zope 2.9.8, if that matters, along with Plone 2.5.4. From: Andreas Jung To: Pedro LaWrench Cc: [email protected] Sent: Tuesday, April 28, 2009 8:09:14 AM Subject: Re: [Zope] how to prevent URL access to an external method? Use a BrowserView?! -aj On Tue, Apr 28, 2009 at 17:04, Pedro LaWrench wrote: I need to do something on the filesystem, which requires unrestricted python, so I created an external method. The problem is that anyone can call that directly via URL, so I added a permission check. Even then, users with the sufficient permissions can call this via URL, which I don't want them to do. I only want them to have access indirectly from other pages (such as a page template that will pass sane parameters). Is there anyway to do this? Thanks, PL ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
Click at the Proxy tab at method with "View" permission - Original Message - From: "Pedro LaWrench" I need to do something on the filesystem, which requires unrestricted python, so I created an external method. The problem is that anyone can call that directly via URL, so I added a permission check. Even then, users with the sufficient permissions can call this via URL, which I don't want them to do. I only want them to have access indirectly from other pages (such as a page template that will pass sane parameters). Is there anyway to do this? ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
Use a BrowserView?! -aj On Tue, Apr 28, 2009 at 17:04, Pedro LaWrench wrote: > > I need to do something on the filesystem, which requires unrestricted > python, so I created an external method. The problem is that anyone can call > that directly via URL, so I added a permission check. Even then, users with > the sufficient permissions can call this via URL, which I don't want them to > do. I only want them to have access indirectly from other pages (such as a > page template that will pass sane parameters). Is there anyway to do this? > > Thanks, > PL > > > > ___ > Zope maillist - [email protected] > http://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope-dev ) > ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how to prevent URL access to an external method?
Within the ExternalMethod you could check the ACTUAL_URL variable (in REQUEST) and if the name of the external method is found you could redirect the user to a "you're a baaad user" page. Jonathan - Original Message - From: "Pedro LaWrench" To: Sent: Tuesday, April 28, 2009 11:04 AM Subject: [Zope] how to prevent URL access to an external method? I need to do something on the filesystem, which requires unrestricted python, so I created an external method. The problem is that anyone can call that directly via URL, so I added a permission check. Even then, users with the sufficient permissions can call this via URL, which I don't want them to do. I only want them to have access indirectly from other pages (such as a page template that will pass sane parameters). Is there anyway to do this? Thanks, PL ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.12.6/2084 - Release Date: 04/28/09 06:15:00 ___ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
