Validate base_url in builder instead of expect() on every use #16

Closed
opened 2026-07-25 11:18:11 +00:00 by GKaszewski · 0 comments
Owner

Severity: Medium

src/actors.rs:122-126: ActorUrls::build() uses .expect("valid url") on four Url::parse calls. These are constructed from a user-supplied base_url string. If base_url is malformed, these panic at runtime.

The actor_url() function in src/urls.rs:39-42 has the same problem.

Fix: validate base_url once at construction time in the builder and return Result, not trust it blindly at every use site.

**Severity: Medium** `src/actors.rs:122-126`: `ActorUrls::build()` uses `.expect("valid url")` on four `Url::parse` calls. These are constructed from a user-supplied `base_url` string. If `base_url` is malformed, these panic at runtime. The `actor_url()` function in `src/urls.rs:39-42` has the same problem. Fix: validate `base_url` once at construction time in the builder and return `Result`, not trust it blindly at every use site.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GKaszewski/k-ap#16