You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to request your thoughts on the following feature idea.
Context
In my ActivityPub web application, I'm parsing untrusted user input as URLs and then storing them in the database. To reject URLs that are too long, I use the garde crate:
// The form accepted by HTTP endpoints#[derive(Validate)]pubstructCreateActivityPubUser{#[garde(length(max = 2048), url)]pubactivity_pub_id:String,// ...}
The Problem
To make working with form structs more ergonomic, I'd like to use an Url value instead of a String. However, there's no way to inspect an Url and check its length, making it impossible to validate an already parsed Url.
Ideal Solution
Provide method on Url structs to obtain some measure of their length. The concrete unit being counted is not important, as long as it allows determining whether an Url exceeds some upper bound.
This would allow garde and other crates to validate Url structs directly:
// The form accepted by HTTP endpoints#[derive(Validate)]pubstructCreateActivityPubUser{#[garde(length(max = 2048))]pubactivity_pub_id:Url,// ...}
Alternative Solutions
Either a method to truncate a given URL to a certain length, or a way to restrict URL length while parsing would work as well.
The text was updated successfully, but these errors were encountered:
I'd like to request your thoughts on the following feature idea.
Context
In my ActivityPub web application, I'm parsing untrusted user input as URLs and then storing them in the database. To reject URLs that are too long, I use the garde crate:
The Problem
To make working with form structs more ergonomic, I'd like to use an
Url
value instead of aString
. However, there's no way to inspect anUrl
and check its length, making it impossible to validate an already parsedUrl
.Ideal Solution
Provide method on
Url
structs to obtain some measure of their length. The concrete unit being counted is not important, as long as it allows determining whether anUrl
exceeds some upper bound.This would allow
garde
and other crates to validateUrl
structs directly:Alternative Solutions
Either a method to truncate a given URL to a certain length, or a way to restrict URL length while parsing would work as well.
The text was updated successfully, but these errors were encountered: