Make sure temporary files are secure

이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

Metadata

ID: python-security/mktemp

Language: Python

Severity: Notice

Category: Security

CWE: 377

Description

Using insecure temporary files makes your program vulnerable to attacks. The official Python documentation reports this module being vulnerable to attacks. Instead of mktemp, use the secure version mkstemp().

Learn More

Non-Compliant Code Examples

from tempfile import mktemp
mktemp(dir=self._tmp_dir)
import tempfile
tempfile.mktemp(dir=self._tmp_dir)

Compliant Code Examples

tempfile.mktemp(dir=self._tmp_dir)
import tempfile
tempfile.mkstemp(dir=self._tmp_dir)
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis