Skip to content

fix(integrations): exit cleanly on malformed --integration-options quoting#3458

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/integration-options-shlex
Open

fix(integrations): exit cleanly on malformed --integration-options quoting#3458
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/integration-options-shlex

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

fixes #3457

_parse_integration_options called shlex.split(raw_options) unguarded. an unbalanced quote in the flag value (e.g. --integration-options='--commands-dir "foo') makes shlex raise ValueError: No closing quotation, so a raw traceback escaped instead of the typer.Exit(1) error every other bad-input path in this function produces (unknown option, missing value, unexpected value). reachable from specify init and every integration install/switch/upgrade/migrate that accepts --integration-options.

fix: wrap the shlex.split in try/except and convert ValueError into the same clean one-line CLI error + exit 1.

added a regression test (test_malformed_quoting_exits_cleanly) asserting a typer.Exit on an unbalanced quote. i confirmed it fails on the pre-fix code by stashing the source and re-running (raw ValueError: No closing quotation); the parse-options tests pass with the fix.

note: i used an ai assistant to help investigate and write this up.

…oting

_parse_integration_options called shlex.split(raw_options) unguarded. an
unbalanced quote (e.g. --integration-options='--commands-dir "foo') makes
shlex raise ValueError('No closing quotation'), so a raw traceback escaped
instead of the typer.Exit(1) error every other bad-input path in this function
produces. reachable from specify init and every integration install/switch/
upgrade/migrate that accepts --integration-options.

wrap the split and convert ValueError into the same clean CLI error. added a
regression test; confirmed it fails on the pre-fix code (raw ValueError).
@Quratulain-bilal Quratulain-bilal requested a review from mnriem as a code owner July 10, 2026 16:17
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.

--integration-options with an unbalanced quote crashes with a raw ValueError

1 participant