This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients alexandre.vassalotti, belopolsky, exarkun, lemburg, pitrou
Date 2010-08-02.14:27:35
SpamBayes Score 1.2456348e-05
Marked as misclassified No
Message-id <4C56D5D6.9060503@egenix.com>
In-reply-to <AANLkTinZsYSir8JSrLXV_eT82qBEdX_JQqtOLD8t5JXy@mail.gmail.com>
Content
Alexander Belopolsky wrote:
> 
> Alexander Belopolsky <belopolsky@users.sourceforge.net> added the comment:
> 
> On Mon, Aug 2, 2010 at 10:11 AM, Marc-Andre Lemburg
> <report@bugs.python.org> wrote:
> ..
>> Hmm, I just tried the code and it seems that you're right:
>>
>> The pickle string does not contain a reference to class x,
>> but only the name of the function to call. Wow, that's a huge
>> hole in Python's pickle system...
> 
> That's why we have a big red
> 
> """
> Warning: The pickle module is not intended to be secure against
> erroneous or maliciously constructed data. Never unpickle data
> received from an untrusted or unauthenticated source.
> """
> 
> in the docs.

Good :-)

I've never used .__reduce__() and wasn't aware of the
fact that it can be used to run arbitrary code without
relying on the defining class.

I also like Antoine's idea of pickling the function/method name
instead of the whole code object.

This is in line with PEP 307 (http://www.python.org/dev/peps/pep-0307/)
which already uses the approach for classic class objects, Python
functions, etc.
History
Date User Action Args
2010-08-02 14:27:37lemburgsetrecipients: + lemburg, exarkun, belopolsky, pitrou, alexandre.vassalotti
2010-08-02 14:27:35lemburglinkissue9276 messages
2010-08-02 14:27:35lemburgcreate