Make sure temporary files are secure

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

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

PREVIEWING: mervebolat/span-id-preprocessing