Repository navigation
fix: complete pre-clap intercepts — meta flags + grep flag fallbacks - #99
Merged
Merged
Conversation
Issue #96 — META_PASSTHROUGH_BINS gap Add the Python/Ruby subcommand-style wrappers (pytest, ruff, mypy, rake, rubocop, rspec, pip) to META_PASSTHROUGH_BINS. All seven are real clap subcommands using trailing_var_arg, so `--version` was captured into args and run through the filter handler, which mangled version output (production DB recorded `pytest --version` at -75% savings over 90 calls). Routing them to clean passthrough fixes this. The regression test test_meta_passthrough_covers_all_subcommand_only_wrappers is extended to match. To preserve the issue #36 runtime-env hardening that the per-tool filter handlers apply, run_simple_passthrough now builds its command via the new secure_meta_command dispatcher instead of a bare resolved_command. Without this the meta-flag path re-exposed RUBYOPT/PYTHONPATH/NODE_OPTIONS injection (caught by tests/runtime_hardening.rs::rake_rubyopt_is_not_executed). Issue #97 — residual grep clap fallbacks After #88 (which handled -r/-R/--recursive/-A/-B/-C), grep still clap-failed on other standard flags. Classification: - -E (extended regex): no-op for rg (extended by default) -> STRIP, generalised the recursive-strip pass via GREP_STRIPPABLE_SHORTS. - -H (with-filename): cosmetic for rg -> STRIP. - -rnE / -HnE bundles: r/E/H peeled from the bundle, -n survives -> STRIP. - -o (only-matching): ALREADY handled — listed in grep_format_flag_present SHORT_LETTERS, routes to passthrough. - -l (files-with-matches): clap claims -l for --max-len (a usize), so bare `grep -l <pattern>` failed parsing. grep_format_flag_present now routes bare/bundled/trailing -l to rg, but leaves `-l <numeric>` for clap as --max-len. Routed flags still pass through run_grep_format_passthrough + check_forbidden_rg_args (issue #32). Tests: extended grep_format_flag_tests, grep_preprocess_tests, and meta_flag_tests. All 2269 workspace tests pass. Closes #96. Closes #97. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ning Codex review of #96/#97: secure_meta_command sent docker/kubectl/gh/ glab/aws/psql/gt to the generic universal-strip fallback, bypassing their tool-specific secure_*_command builders (issue #36/#37/#38 env hardening). Silent regression on the meta-flag path. Add explicit dispatch arms for every binary with a dedicated builder. Also: stop stripping grep -H unconditionally (dropped filename output). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
8 tasks
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
Closes #96. Closes #97. Completes the pre-clap intercept coverage so more invocations stop falling through to raw exec /
parse_failures.#96 — META_PASSTHROUGH_BINS gap
pytest --versionrecorded −75% over 90 calls. These wrappers use claptrailing_var_arg, so--versionwasn't rejected — it was captured and run through the filter handler, mangling output. Addedpytest,ruff,mypy,rake,rubocop,rspec,pipto the meta-flag intercept.#97 — residual grep clap fallbacks
After #88 (recursive/context flags), grep still clap-failed on
-E,-H,-l, bundles. Now:-Estripped (rg is extended-regex by default — genuine no-op),-Hrouted to passthrough (rg honours--with-filename),-lrouted to passthrough,-oalready handled.Security — CRITICAL caught in review
The meta-flag passthrough initially used a bare
resolved_command, bypassing the per-tool env hardening (issues #36/#37/#38 —RUBYOPT/PYTHONPATH/DOCKER_CONFIG/KUBECONFIG/AWS_CONFIG_FILE/...). Asecure_meta_commanddispatcher now routes every meta-passthrough binary to its tool-specificsecure_*_commandbuilder:secure_cargo_commandsecure_node_commandsecure_go_commandsecure_python_commandsecure_ruby_commandsecure_*_commandThis also retroactively hardens the existing cargo/npm/go meta entries from #90.
Test plan
cargo test --workspace— 2272 pass, 0 failsecure_meta_dispatchtestspytest --version,rake --version,pip --version,grep -E/-H/-rnE/-l— no clap errors-Hregression) found and fixed; 4 pre-existing tests that codified the-Hbug corrected🤖 Generated with Claude Code