fix(komide): validate_url uses url::Url parse (closes #203)#205
Merged
forkwright merged 1 commit intomainfrom Apr 19, 2026
Merged
fix(komide): validate_url uses url::Url parse (closes #203)#205forkwright merged 1 commit intomainfrom
forkwright merged 1 commit intomainfrom
Conversation
…closes #203) SECURITY/insecure-transport was flagging the literal "http://" prefix check even though the function is a URL validator (not an outbound request). Replaced prefix match with proper url::Url parse + scheme check — rejects non-HTTP(S) schemes, empty URLs, and malformed inputs that the prefix form silently accepted (e.g. "http://" with no host). Added `url` to workspace dependencies and komide crate deps. Extended test coverage: loopback+port, LAN host, javascript: scheme, scheme-relative URLs, and schemeless/hostless edge cases. Closes #203.
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
Replaces the
validate_urlprefix-match inkomide/src/service/mod.rswith a fullurl::Urlparse + scheme check. Closes #203.Before:
After:
Why option C (full parse) over suppression:
http://(no host),http://foo bar(malformed), etc.SECURITY/insecure-transportrule no longer matches (no literal"http://").Added
urlto workspace dependencies and the komide crate; it was already a transitive dep via reqwest.Test plan
cargo check -p komide— cleancargo nextest run -p komide— 43/43 pass (9 new validate_url cases: loopback+port, LAN host, javascript:, scheme-relative, hostless http://, https:-only, non-parseable)kanon lint crates/komide --summary—SECURITY/insecure-transportcleared (28 -> 27 total; remaining 27 are pre-existing, unrelated)cargo fmt --check— cleankanon gate --stamp— blocked on pre-existing type_complexity expect + other workspace lint warnings from main (not introduced by this PR). PR fix(clippy): clear 5 pre-existing too-many-args + unfulfilled expect errors #204 (fix/clippy-too-many-args-post-lint-sync) addresses the clippy side. Main thread to re-gate once that chain lands.Based on
github/main @ a18094c, kept independent of PRs #200/#201/#202/#204.