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 {
175175 HostConfig :: List ( l) => l. iter ( ) . any ( |h| h. as_str ( ) == host) ,
176176 HostConfig :: ToSelf => false ,
177177 HostConfig :: Cidr ( c) => {
178- let Ok ( ip) = host. parse :: < ipnet :: IpNet > ( ) else {
178+ let Ok ( ip) = host. parse :: < std :: net :: IpAddr > ( ) else {
179179 return false ;
180180 } ;
181181 c. contains ( & ip)
@@ -776,4 +776,11 @@ mod test {
776776 . allows
( & OutboundUrl :: parse
( "mysql://user%3Apass%[email protected] " , "mysql" ) . unwrap
( ) ) ) ; 777777 assert ! ( allowed
. allows
( & OutboundUrl :: parse
( "user%3Apass%[email protected] " , "mysql" ) . unwrap
( ) ) ) ; 778778 }
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+ }
779786}
You can’t perform that action at this time.
0 commit comments