feat: add dash flag support for safe commands in bash executor #82
Merged
feat: add dash flag support for safe commands in bash executor #82
Conversation
- Add `allow_dash` field to `SafeCommandConfigEntry` and `ArgPolicy` variants - Extend argument validation logic to handle single dash (`-`) arguments - Single dash can be allowed for safe commands when configured via `allow_dash: true` - Maintain backward compatibility - defaults to false for existing rules - Add comprehensive tests to verify safe command detection with dash arguments - Improve path validation to handle dash arguments when positional args are allowed
…xecutor - Extend safe command parsing to support single dash long options (e.g., `-name`, `-type`) - Add `split_single_dash_option()`, `match_single_dash_long_option()` helper functions - Refactor option parsing logic to handle both `--long` and `-long` option formats uniformly - Add `find` command to safe commands list with `-name`, `-type`, and `-maxdepth` flags - Maintain backward compatibility by defaulting to false for existing rules - Update argument validation functions to detect and validate single dash long options - Ensure consistent behavior between consumption and validation paths
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #82 +/- ##
==========================================
- Coverage 59.37% 59.31% -0.06%
==========================================
Files 77 77
Lines 15921 16979 +1058
==========================================
+ Hits 9453 10071 +618
- Misses 6468 6908 +440 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
No description provided.