[Python-Dev] Warn about mktemp once again?

Antoine Pitrou solipsis at pitrou.net
Wed May 7 10:09:52 CEST 2008


Martin v. Löwis <martin <at> v.loewis.de> writes:
> 
> Are you (or are you not) aware that this strategy allows for malicious
> code to provide you with a fake JPEG file? If so, does it not concern
> you?

Yes, I'm aware of it and no, it doesn't concern me. When you write a processing
script for internal use there's no reason to worry about security issues like
that (if someone manages to enter your private machine he can do much more
dangereous things anyway).

> As others have said: the reason the function is deprecated is that it
> is easy to run into security problems while using it,

I know, I've read the doc :)
I'm sure there are lots of other insecure things in Python's stdlib (e.g. HTTP
Basic Authentication, or plaintext authentication in email clients, or
algorithms known to be weak in hashlib) and they haven't been deprecated. Of
course some of those may be necessary for interoperability, while mktemp() isn't.

In any case what I wanted to point out is that the secure replacement for a
one-liner mktemp() is not as concise and obvious as the insecure version, and
that sometimes there are good reasons to not even care about the "security
problems".

Regards

Antoine.




More information about the Python-Dev mailing list