Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mkstemp to replace deprecated mktemp #1836

Closed
wants to merge 1 commit into from

Conversation

fatmo666
Copy link

Description

This Pull Request addresses a security concern related to the use of the deprecated tempfile.mktemp() function, which is known to be insecure due to its susceptibility to race conditions that can lead to temporary file vulnerabilities, as described in CWE-377.

Changes Made

  • Replaced tempfile.mktemp() with tempfile.mkstemp() in metaflow/_vendor/click/_termui_impl.py. tempfile.mkstemp() securely creates a temporary file by returning both a file descriptor and a path, which significantly minimizes the risk of file-based race conditions.

Replace tempfile.mktemp() with tempfile.mkstemp() for enhanced security
@@ -405,7 +405,8 @@ def _tempfilepager(generator, cmd, color):
"""Page through text by invoking a program on a temporary file."""
import tempfile

filename = tempfile.mktemp()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fatmo666 this file is vendored as is from click. to fix this, you would need to update the vendored version for click.

@fatmo666 fatmo666 closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants