Christian Heimes added the comment: > Shouldn't you try to make the permission removal atomic? Otherwise there's a > window of opportunity to exploit the suid bit.
Permissions bits are copied from the source file *after* all data has been copied to the destination file. copy() calls copyfile() followed by copymode() copyfile() doesn't create files with SUID. In fact it has 0666 & umask. In worst case the new file is readable and writable by every user. The new patch addresses the unlikely issue with os.open()ing the file with mask=0600. I could also add a create_mode argument to _io.FileIO() in order to make the permission bits of new files more flexible. Modules/_io/fileio.c hard codes mode as 0600. ---------- Added file: http://bugs.python.org/file30647/17180_preserve_sbits2.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17180> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com