File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
crates/outbound-networking/src Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ impl HostConfig {
175
175
HostConfig :: List ( l) => l. iter ( ) . any ( |h| h. as_str ( ) == host) ,
176
176
HostConfig :: ToSelf => false ,
177
177
HostConfig :: Cidr ( c) => {
178
- let Ok ( ip) = host. parse :: < ipnet :: IpNet > ( ) else {
178
+ let Ok ( ip) = host. parse :: < std :: net :: IpAddr > ( ) else {
179
179
return false ;
180
180
} ;
181
181
c. contains ( & ip)
@@ -776,4 +776,11 @@ mod test {
776
776
. allows
( & OutboundUrl :: parse
( "mysql://user%3Apass%[email protected] " , "mysql" ) . unwrap
( ) ) ) ;
777
777
assert ! ( allowed
. allows
( & OutboundUrl :: parse
( "user%3Apass%[email protected] " , "mysql" ) . unwrap
( ) ) ) ;
778
778
}
779
+
780
+ #[ test]
781
+ fn test_cidr ( ) {
782
+ let allowed =
783
+ AllowedHostsConfig :: parse ( & [ "*://127.0.0.1/24:63551" ] , & dummy_resolver ( ) ) . unwrap ( ) ;
784
+ assert ! ( allowed. allows( & OutboundUrl :: parse( "tcp://127.0.0.1:63551" , "tcp" ) . unwrap( ) ) ) ;
785
+ }
779
786
}
You can’t perform that action at this time.
0 commit comments