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

[Refactor] Scrubbing mktemp calls (CVE) #1257

Merged
merged 4 commits into from
Aug 29, 2021

Conversation

omesser
Copy link
Contributor

@omesser omesser commented Aug 26, 2021

tempfile.mktemp() manifests a known vulnerability wrt race condition between setting the path and obtaining the file handle, which is sometimes worrying, and pops up in security scans even when used in a safe context - https://cwe.mitre.org/data/definitions/377
It is hence deemed deprecated and vulnerable: https://docs.python.org/3/library/tempfile.html#deprecated-functions-and-variables

The underlying issue here will still exist in some cases because the use case is valid - however, we will appease the scans

@omesser omesser requested a review from Hedingber August 26, 2021 16:51
@omesser omesser marked this pull request as draft August 26, 2021 16:57
@omesser omesser marked this pull request as ready for review August 26, 2021 17:22
return tmp, model_spec, extra_dataitems
temp_path = tempfile.NamedTemporaryFile(suffix=suffix, delete=False).name
obj.download(temp_path)
return temp_path, model_spec, extra_dataitems
Copy link
Contributor

Choose a reason for hiding this comment

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

get_model is a function the client may use, you can't just add a new value in the returned tuple, that is non backwards compatible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not add a new value, I renamed an existing one tmp -> temp_path

@omesser omesser requested a review from Hedingber August 29, 2021 06:58
@Hedingber Hedingber changed the title Scrubbing mktemp calls (CVE) [All] Scrubbing mktemp calls (CVE) Aug 29, 2021
@Hedingber Hedingber changed the title [All] Scrubbing mktemp calls (CVE) [Refactor] Scrubbing mktemp calls (CVE) Aug 29, 2021
@Hedingber Hedingber merged commit 98978ee into mlrun:development Aug 29, 2021
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