Repository navigation
fix(settings): deny inline Python fed via heredoc and stdin pipelines (#2797) - #2803
Open
isihussain wants to merge 1 commit into
Open
isihussain wants to merge 1 commit into
isihussain wants to merge 1 commit into
Conversation
…danielmiessler#2797) The native deny rules in settings.system.json previously covered program strings passed on the command line ('python -c *', 'python3 -c *') and stdin flags with trailing arguments ('python - *', 'python3 - *'), but missed stdin programs fed via heredoc (e.g. python3 <<'PY' ... PY) or via pipes (e.g. ... | python3), as well as bare interpreter invocations ('python -', 'python3 -'). Add deny rules for: - 'Bash(python -)' and 'Bash(python3 -)' - 'Bash(python <<*)' and 'Bash(python3 <<*)' - 'Bash(python)' and 'Bash(python3)' Keep script execution ('python3 tool.py --input data.csv') allowed. Add settings.permissions.test.ts verifying rejection of -c, -, heredocs, and pipeline stdin while preserving script execution. Closes danielmiessler#2797 Signed-off-by: isihussain <isihussain@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #2797.
The shipped deny rules for inline Python in settings.system.json covered program strings passed via -c (python -c *, python3 -c *) and stdin invocations with trailing argument globs (python - *, python3 - *). However, they did not match:
Because Python reads from stdin when invoked without a script argument, these forms bypassed the deny rules and permitted inline authoring contrary to the system prompt's language rule.
Solution
Signed-off-by: isihussain isihussain@users.noreply.github.com