Open
Conversation
added 2 commits
March 31, 2026 18:19
Add python-allow-module and python-deny-module config directives so users can customize which Python modules are considered safe or dangerous during static analysis. - Config: parse and validate module names (dotted identifiers only), accumulate across config layers, support inline comments - SafetyAnalyzer: parameterize with extra_safe_modules/extra_deny_modules merged with hardcoded sets. Allow overrides exact matches in the dangerous list (submodules must be allowed separately). - Thread Config through HandlerContext so python handler can access configured module lists. Example .dippy config: python-allow-module numpy python-allow-module pandas python-deny-module requests
- Statically analyze python -c inline code using the existing SafetyAnalyzer AST visitor. Safe code (no I/O, no dangerous imports) is auto-approved. - Track per-word bash expansion flags (word_has_expansions) through HandlerContext so the python handler can detect when -c code contains $VAR or $(cmd) expansions and fall back to ask. - Config module overrides (python-allow-module / python-deny-module) apply to inline code analysis as well.
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.
This PR stacks on top of #122 and provides analysis of
python -cusage. It attempts to deny any analysis on commands that contain any kind of expansion because that makes it too difficult to determine safety.It is easier to review this diff once the lower one is merged but if you have any questions let me know, I am happy to add more tests or make changes