Skip to content

Fix command injection in entrypoint argument handling#6

Open
charlievieth wants to merge 1 commit into
mainfrom
cev/fix-arg-splitting
Open

Fix command injection in entrypoint argument handling#6
charlievieth wants to merge 1 commit into
mainfrom
cev/fix-arg-splitting

Conversation

@charlievieth

@charlievieth charlievieth commented Jul 8, 2026

Copy link
Copy Markdown

Replace sh -c "porter $INPUT_COMMAND" with exec porter $INPUT_COMMAND. The old form re-parsed the input as a shell script, so metacharacters (; | && $() backticks) in INPUT_COMMAND were executed. Direct unquoted expansion still word-splits into multiple args/flags but passes them to porter as literal argument text, closing the injection hole. Using exec also avoids the extra subshell so signals and exit codes propagate cleanly.

Replace `sh -c "porter $INPUT_COMMAND"` with `exec porter $INPUT_COMMAND`.
The old form re-parsed the input as a shell script, so metacharacters
(; | && $() backticks) in INPUT_COMMAND were executed. Direct unquoted
expansion still word-splits into multiple args/flags but passes them to
porter as literal argument text, closing the injection hole. Using exec
also avoids the extra subshell so signals and exit codes propagate cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJ6dDbHQymBQw7zpXY64LS
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