@@ -48,8 +48,15 @@ describe("assertSafeWebhookUrl", () => {
4848 ) . rejects . toBeInstanceOf ( UnsafeWebhookUrlError ) ;
4949 } ) ;
5050
51- it ( "rejects CGNAT, multicast and reserved ranges" , async ( ) => {
52- for ( const host of [ "100.64.0.1" , "224.0.0.1" , "239.1.1.1" , "240.0.0.1" ] ) {
51+ it ( "rejects CGNAT, benchmarking, multicast and reserved ranges" , async ( ) => {
52+ for ( const host of [
53+ "100.64.0.1" ,
54+ "198.18.0.0" ,
55+ "198.19.255.255" ,
56+ "224.0.0.1" ,
57+ "239.1.1.1" ,
58+ "240.0.0.1" ,
59+ ] ) {
5360 await expect ( assertSafeWebhookUrl ( `http://${ host } /hook` ) ) . rejects . toBeInstanceOf (
5461 UnsafeWebhookUrlError
5562 ) ;
@@ -92,6 +99,8 @@ describe("assertSafeWebhookUrl", () => {
9299describe ( "assertAddressAllowed" , ( ) => {
93100 it ( "allows public IPv4 / IPv6 addresses" , ( ) => {
94101 expect ( ( ) => assertAddressAllowed ( "93.184.216.34" , 4 ) ) . not . toThrow ( ) ;
102+ expect ( ( ) => assertAddressAllowed ( "198.17.255.255" , 4 ) ) . not . toThrow ( ) ;
103+ expect ( ( ) => assertAddressAllowed ( "198.20.0.0" , 4 ) ) . not . toThrow ( ) ;
95104 expect ( ( ) => assertAddressAllowed ( "2606:2800:220:1:248:1893:25c8:1946" , 6 ) ) . not . toThrow ( ) ;
96105 } ) ;
97106
@@ -104,6 +113,8 @@ describe("assertAddressAllowed", () => {
104113 "192.168.1.1" ,
105114 "169.254.169.254" ,
106115 "100.64.0.1" ,
116+ "198.18.0.0" ,
117+ "198.19.255.255" ,
107118 ] ) {
108119 expect ( ( ) => assertAddressAllowed ( addr , 4 ) ) . toThrow ( UnsafeWebhookUrlError ) ;
109120 }
0 commit comments