# Insecure Temporary File Creation - ID: python-insecure-tempfile - Severity: MEDIUM - CWE: CWE-377 (CWE-377) - Languages: Python ## Description Detects insecure temporary file creation using tempfile.mktemp(), predictable names, or world-readable permissions. These can lead to symlink attacks, race conditions, or information disclosure. Use tempfile.mkstemp() or NamedTemporaryFile. ## Remediation Use tempfile.NamedTemporaryFile or tempfile.mkstemp instead of mktemp(). ```python import tempfile with tempfile.NamedTemporaryFile(mode='w+', delete=True) as tmp: tmp.write(data) tmp.flush() result = process_file(tmp.name) ``` Learn more: https://shoulder.dev/learn/python/cwe-377/insecure-tempfile ## Documentation [object Object]