-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
rhshadrach
merged 8 commits into
pandas-dev:main
from
r0rshark:add_rce_risk_documentation
May 22, 2024
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
77351fd
Document Remote Code Execution risk for Dataframe.query and computati…
r0rshark b942474
fix docstring lint
r0rshark 23abff5
Merge remote-tracking branch 'upstream/main' into add_rce_risk_docume…
r0rshark 79c603e
fixed trailing space
r0rshark 44e103e
Revert "fixed trailing space"
r0rshark d18aac8
fixed trailing space
r0rshark 837d5b8
Addressed feedback
r0rshark 2de2030
Merge remote-tracking branch 'upstream/main' into add_rce_risk_docume…
r0rshark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4473,6 +4473,10 @@ def query(self, expr: str, *, inplace: bool = False, **kwargs) -> DataFrame | No | |||||||||||
""" | ||||||||||||
Query the columns of a DataFrame with a boolean expression. | ||||||||||||
|
||||||||||||
This function pass the `expr` parameter to :meth:`~pandas.DataFrame.eval`. | ||||||||||||
This allows `eval` to run arbitrary code, which can make you vulnerable to code | ||||||||||||
injection if you pass user input to this function. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't think we need to mention the implementation details; it's sufficient to warn that query can run arbitrary code. |
||||||||||||
|
||||||||||||
Parameters | ||||||||||||
---------- | ||||||||||||
expr : str | ||||||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an internal method, right? In such case, I don't think this is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - this is exposed at the top level. Agree with including it, but I don't think starting with
This
is accurate - itreads to me like that refers to the previous sentence. Can just say