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

DOC: Update warning message in pandas.eval function #59108

Merged
merged 4 commits into from
Jun 27, 2024

Conversation

eilonc-cx
Copy link
Contributor

Summary

This pull request updates the pandas.eval documentation to add a security warning about the risks of arbitrary code execution when using the function with untrusted data. This update aims to enhance user awareness and security practices.

Background

The need for this documentation update was identified by Duarte Santos from Checkmarx's Research Group. A vulnerability was discovered that allows for arbitrary code execution through the misuse of pandas.eval with untrusted inputs.

Proposed Change

Location: pandas.eval documentation
Update: Insert a warning advising users against the use of pandas.eval with untrusted data, highlighting the potential for arbitrary code execution.

Warning Text:

Warning: Use pandas.eval only with trusted data. This function can execute arbitrary code if used with untrusted inputs, similar to the risks associated with Python's pickle module documentation.

Rationale

This documentation update is crucial for preventing security issues by making users aware of the risks associated with dynamic expression evaluation in pandas.eval. The update follows a preliminary discussion with the Pandas security team and is now presented for broader community feedback.

Thank you for considering this update to enhance the safety and integrity of code using Pandas.

Regards,
Eilon Cohen
Security Analyst, Checkmarx

@mroeschke mroeschke added the Docs label Jun 26, 2024
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@eilonc-cx
Copy link
Contributor Author

eilonc-cx commented Jun 26, 2024

Hi @mroeschke

Thank you for suggesting the warning change for the eval function.
Considering the potential risks with its use, I think a more "aggressive" warning might better communicate the severity to users. What do you think?

@mroeschke
Copy link
Member

What do you think?

IMO it's preferable to have succinct messaging since this docstring is already long. I suggested to fold in "untrusted data" since that was net new information that could be helpful here.

@mroeschke mroeschke added this to the 3.0 milestone Jun 27, 2024
@mroeschke mroeschke merged commit 0320b3c into pandas-dev:main Jun 27, 2024
45 checks passed
@mroeschke
Copy link
Member

Thanks @eilonc-cx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants