Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 348 Bytes

TMP101.md

File metadata and controls

14 lines (9 loc) · 348 Bytes

TMP101

Using a hardcoded path to read or write temporary files is insecure and leaves it open to attackers replacing the file contents.

Example

with open('/tmp/my_app', 'w') as tmp_file:
    tmp_file.write('data')

Fixes

  • Use tempfile.mkstemp() or another standard library function for generating temporary file names