How much is set in stone?

Erno Kuusela erno-news at
Tue Nov 13 04:59:16 CET 2001

In article <7x8zddnroj.fsf at>, Paul Rubin
<phr-n2001d at> writes:

| In fact it does the opposite--both the documentation and the pickle
| implementation (look at the "security" check for pickled strings)
| appear written with the idea that unickling is intended to be safe for
| untrusted strings.

i can't see that idea in the documentation even if i try.

i don't know what the "security" check in the source code is about,
perhaps the pickle author was planning to make it safe for untrusted
data at some point.

the fact that pickle shouldn't be fed untrusted data has been common
knowledge in the python user and developer communities as long as i
can remember.

| If you look at docs for the Cookie module, you see
| that it originally used pickle in precisely this dangerous way.  If
| that got past the maintainers who allowed the Cookie module to be
| shipped with the Python library, what chance do most ordinary users
| have?

iirc the cookie module had this erroneous code before it was accepted
into the library.

when it was put in the library, warnings were put in its documentation
to warn against anyone ever using the functionality.

| Re marhsal: is it dangerous to unmarshal an untrusted string?  Yes, I
| know that marshalled strings can contain code objects, but
| unmarshalling the strings doesn't actually RUN such code objects, as
| far as I know.  I haven't examined marshal super-carefully though.

hmm, you may be right.

  -- erno

More information about the Python-list mailing list