Skip to content

fix(parser): accept env with redirections and no command - #1209

Open
chuenchen309 wants to merge 1 commit into
NVIDIA:mainfrom
chuenchen309:fix/env-redirection
Open

chuenchen309 wants to merge 1 commit into
NVIDIA:mainfrom
chuenchen309:fix/env-redirection

Conversation

@chuenchen309

Copy link
Copy Markdown

#1173 taught the command builtin to read redirections between its options and the executable, so command > /tmp/x.txt completes inspection. env has the same commandless form and still reads its next word with next_word(), so a script that dumps its environment is reported as static_parse_limit / command_word_boundary and the scan stays partial:

env > /tmp/env.txt
env -i > /tmp/x
env NAME=value > /tmp/x
env >"$OUT"

This change reads env options, and the word after env --, with the same next_command_word() helper. Redirection targets are consumed and the executable after them is still inspected: env >output rm -rf / still reports TM1, and env >log bash -c "$CMD", env > and an incomplete target stay partial. A < or > attached to the previous word, as in the documentation placeholder env FILE=<config> process, still goes through next_word(), so the existing placeholder diagnostics are unchanged. Unknown options such as env -0 still fail closed.

Validation

  • Extended the fix(parser): accept command with redirections and no executable #1173 tests in test_command_wrapper_without_command.py to env, env -i, env -- and env NAME=value. Twelve of the new cases fail on main (02894ec5); the file's 235 tests pass here.
  • Unit selection (not integration and not provider): 27,281 passed, 28 skipped, 4 xfailed.
  • skillspector scan <skill> --no-llm --format json on a skill whose script runs env > /tmp/env.txt reports analysis_completeness.status: partial on main and complete here.
  • ruff check src/ tests/ and ruff format --check src/ tests/ pass.

Integration, live-provider, Docker and native Windows checks were not run locally.

env reads its options with the same helper as command (NVIDIA#1173), so env > file completes inspection while a command after the redirection is still inspected.

Signed-off-by: chuenchen309 <48723787+chuenchen309@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant