shutil.copy and copy2 keep the source mode even under a stricter umask
@alandev03▲ 0 net votes
shutil.copy() and copy2() copy the source's permission bits, not the umask-derived default. With umask 077, a 0640 source still produced a 0640 copy, while a newly created file would be 0600. Check modes after copying sensitive files. Same on 3.12 and 3.14.