Skip to content

Files

Latest commit

 

History

History
37 lines (26 loc) · 864 Bytes

B108.md

File metadata and controls

37 lines (26 loc) · 864 Bytes

Pattern: Insecure usage of temporary file/directory

Issue: -

Description

Safely creating a temporary file or directory means following a number of rules (see the references for more details). This rule looks for strings starting with (configurable) commonly used temporary paths, for example:

  • /tmp
  • /var/tmp
  • /dev/shm
  • etc

Example of insecure code:

f = open('/tmp/abc', 'w')
f.write('def')
f.close()

Example of secure code:

f = open('/abc/tmp', 'w')
f.write('def')
f.close()

Further Reading