Repository navigation
fix(cli): validate URL scheme and non-empty token in local configure and client - #18703
Closed
I-Am-Finite wants to merge 1 commit into
Closed
I-Am-Finite wants to merge 1 commit into
I-Am-Finite wants to merge 1 commit into
Conversation
Member
|
Thanks @I-Am-Finite — nice first contribution, and a genuinely useful hardening pass. Reviewed each changed file:
Verification I ran on the head commit:
Minor, non-blocking: the error details interpolate the raw URL as-is; fine given the Text-span rendering, just worth keeping in mind if error output ever moves to a markup-parsed surface. This feedback is AI-generated on behalf of the Omi maintainers. Leaving the merge decision to a human maintainer — no urgency; this is a positive signal on a clean change. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
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
Validates that
omi local configureonly accepts validhttp://orhttps://URLs with hosts and rejects empty/whitespace tokens, matching the validation already enforced inomi config set. Also hardensLocalOmiClientto validate input URLs and tokens before creating the HTTP client.Problem & Root Cause
sdks/python-cli/omi_cli/commands/local.py,configuredid not validate--urlor--token. Users or scripts supplying invalid URLs (e.g.ftp://, missing schemes, or empty hosts) or empty/whitespace tokens had their config saved in a corrupted state, leading to later crashes or confusing auth/transport errors during subsequentomi localcommands.omi config set local_api_urlandomi config set local_tokenexplicitly validate URL schemes, host presence, and non-empty tokens.LocalOmiClientalso passed raw unvalidated URL schemes to httpx without verifying the presence of http/https schemes and valid netlocs.Fix
sdks/python-cli/omi_cli/commands/local.py:urluseshttporhttpsand contains a valid host viaurlsplit, raisingUsageErrorotherwise.tokenis non-empty after stripping whitespace, raisingUsageErrorotherwise.sdks/python-cli/omi_cli/local_client.py:LocalOmiClient.__init__, raisingCliErrorwith exit code 2 on invalid URLs.sdks/python-cli/tests/test_local.py:omi local configure.omi local configure.LocalOmiClientvalidation errors.Verification
pytest sdks/python-cli/tests/test_local.py: 59 passedblack --checkandisort --check: cleanProposed Bounty ($25 USD)
0x8B98e73a65add5145907E5aA990bC9c25c0bBAC9)cc @kodjima33 @aryanorastar @Git-on-my-level