fix(integrations): exit cleanly on malformed --integration-options quoting#3458
Open
Quratulain-bilal wants to merge 1 commit into
Open
fix(integrations): exit cleanly on malformed --integration-options quoting#3458Quratulain-bilal wants to merge 1 commit into
Quratulain-bilal wants to merge 1 commit into
Conversation
…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).
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.
fixes #3457
_parse_integration_optionscalledshlex.split(raw_options)unguarded. an unbalanced quote in the flag value (e.g.--integration-options='--commands-dir "foo') makes shlex raiseValueError: No closing quotation, so a raw traceback escaped instead of thetyper.Exit(1)error every other bad-input path in this function produces (unknown option, missing value, unexpected value). reachable fromspecify initand every integration install/switch/upgrade/migrate that accepts--integration-options.fix: wrap the
shlex.splitin try/except and convertValueErrorinto the same clean one-line CLI error + exit 1.added a regression test (
test_malformed_quoting_exits_cleanly) asserting atyper.Exiton an unbalanced quote. i confirmed it fails on the pre-fix code by stashing the source and re-running (rawValueError: No closing quotation); the parse-options tests pass with the fix.note: i used an ai assistant to help investigate and write this up.