Skip to content

DOC: Document Remote Code Execution risk for Dataframe.query and computation.eval #58697

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

Merged
merged 8 commits into from
May 22, 2024
2 changes: 2 additions & 0 deletions pandas/core/computation/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def eval(
corresponding bitwise operators. :class:`~pandas.Series` and
:class:`~pandas.DataFrame` objects are supported and behave as they would
with plain ol' Python evaluation.
`eval` can run arbitrary code which can make you vulnerable to code
injection if you pass user input to this function.

Parameters
----------
Expand Down
3 changes: 3 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4472,6 +4472,9 @@ def query(self, expr: str, *, inplace: bool = False, **kwargs) -> DataFrame | No
"""
Query the columns of a DataFrame with a boolean expression.

This method can run arbitrary code which can make you vulnerable to code
injection if you pass user input to this function.

Parameters
----------
expr : str
Expand Down
Loading