Changeset 3442401
- Timestamp:
- 01/19/2026 10:15:30 AM (2 months ago)
- Location:
- anac-xml-viewer
- Files:
-
- 4 edited
- 1 copied
-
tags/1.8.3 (copied) (copied from anac-xml-viewer/trunk)
-
tags/1.8.3/anac-xml-viewer.php (modified) (3 diffs)
-
tags/1.8.3/readme.txt (modified) (2 diffs)
-
trunk/anac-xml-viewer.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
anac-xml-viewer/tags/1.8.3/anac-xml-viewer.php
r3412265 r3442401 5 5 Description: Visualizzatore XML per file generati da applicativi esterni 6 6 Author: Marco Milesi 7 Version: 1.8. 27 Version: 1.8.3 8 8 Author URI: https://marcomilesi.com 9 9 */ … … 271 271 } 272 272 273 private function is_private_ip( $ip ) {274 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {275 $long = ip2long($ip);276 $ranges = [277 ['0.0.0.0', '0.255.255.255'],278 ['10.0.0.0', '10.255.255.255'],279 ['127.0.0.0', '127.255.255.255'],280 ['169.254.0.0', '169.254.255.255'],281 ['172.16.0.0', '172.31.255.255'],282 ['192.168.0.0', '192.168.255.255']283 ];284 foreach ( $ranges as $r ) {285 if ( $long >= ip2long($r[0]) && $long <= ip2long($r[1]) ) return true;286 }287 return false;288 }289 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {290 if ( strpos($ip, '::1') === 0 ) return true; // localhost291 // fc00::/7 unique local, fe80::/10 link-local292 if ( strpos($ip, 'fc') === 0 || strpos($ip, 'fd') === 0 ) return true;293 if ( strpos($ip, 'fe80') === 0 ) return true;294 return false;295 }296 return true;297 }298 299 273 private function fetch_and_load_xml( $url ) { 300 274 if ( ! function_exists('wp_http_validate_url') || ! wp_http_validate_url( $url ) ) return null; 301 $parts = wp_parse_url( $url );302 if ( ! $parts || ! isset($parts['scheme']) || ! in_array( strtolower($parts['scheme']), ['http','https'], true ) ) return null;303 if ( empty($parts['host']) ) return null;304 305 $host = $parts['host'];306 $blocked_hosts = [307 '169.254.169.254',308 'metadata.google.internal'309 ];310 if ( in_array( strtolower($host), $blocked_hosts, true ) ) return null;311 312 $resolved = gethostbynamel( $host );313 if ( $resolved ) {314 foreach ( $resolved as $ip ) {315 if ( $this->is_private_ip( $ip ) ) return null;316 }317 }318 275 319 276 $args = [ … … 322 279 'headers' => [ 'Accept' => 'application/xml, text/xml; q=0.9, */*; q=0.1' ], 323 280 ]; 324 $response = wp_ remote_get( $url, $args );281 $response = wp_safe_remote_get( $url, $args ); 325 282 if ( is_wp_error( $response ) ) return null; 326 283 -
anac-xml-viewer/tags/1.8.3/readme.txt
r3412265 r3442401 5 5 Requires at least: 4.3 6 6 Tested up to: 6.9 7 Version: 1.8. 28 Stable tag: 1.8. 27 Version: 1.8.3 8 Stable tag: 1.8.3 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 40 40 41 41 > Questa è la lista completa di tutti gli aggiornamenti, test e correzioni. Ogni volta che una nuova versione viene rilasciata assicuratevi di aggiornare il prima possibile per usufruire delle ultime migliorie! 42 43 = 1.8.3 2026-01-19 = 44 * Bugfix minori e sicurezza 42 45 43 46 = 1.8.2 2025-12-05 = -
anac-xml-viewer/trunk/anac-xml-viewer.php
r3412265 r3442401 5 5 Description: Visualizzatore XML per file generati da applicativi esterni 6 6 Author: Marco Milesi 7 Version: 1.8. 27 Version: 1.8.3 8 8 Author URI: https://marcomilesi.com 9 9 */ … … 271 271 } 272 272 273 private function is_private_ip( $ip ) {274 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {275 $long = ip2long($ip);276 $ranges = [277 ['0.0.0.0', '0.255.255.255'],278 ['10.0.0.0', '10.255.255.255'],279 ['127.0.0.0', '127.255.255.255'],280 ['169.254.0.0', '169.254.255.255'],281 ['172.16.0.0', '172.31.255.255'],282 ['192.168.0.0', '192.168.255.255']283 ];284 foreach ( $ranges as $r ) {285 if ( $long >= ip2long($r[0]) && $long <= ip2long($r[1]) ) return true;286 }287 return false;288 }289 if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {290 if ( strpos($ip, '::1') === 0 ) return true; // localhost291 // fc00::/7 unique local, fe80::/10 link-local292 if ( strpos($ip, 'fc') === 0 || strpos($ip, 'fd') === 0 ) return true;293 if ( strpos($ip, 'fe80') === 0 ) return true;294 return false;295 }296 return true;297 }298 299 273 private function fetch_and_load_xml( $url ) { 300 274 if ( ! function_exists('wp_http_validate_url') || ! wp_http_validate_url( $url ) ) return null; 301 $parts = wp_parse_url( $url );302 if ( ! $parts || ! isset($parts['scheme']) || ! in_array( strtolower($parts['scheme']), ['http','https'], true ) ) return null;303 if ( empty($parts['host']) ) return null;304 305 $host = $parts['host'];306 $blocked_hosts = [307 '169.254.169.254',308 'metadata.google.internal'309 ];310 if ( in_array( strtolower($host), $blocked_hosts, true ) ) return null;311 312 $resolved = gethostbynamel( $host );313 if ( $resolved ) {314 foreach ( $resolved as $ip ) {315 if ( $this->is_private_ip( $ip ) ) return null;316 }317 }318 275 319 276 $args = [ … … 322 279 'headers' => [ 'Accept' => 'application/xml, text/xml; q=0.9, */*; q=0.1' ], 323 280 ]; 324 $response = wp_ remote_get( $url, $args );281 $response = wp_safe_remote_get( $url, $args ); 325 282 if ( is_wp_error( $response ) ) return null; 326 283 -
anac-xml-viewer/trunk/readme.txt
r3412265 r3442401 5 5 Requires at least: 4.3 6 6 Tested up to: 6.9 7 Version: 1.8. 28 Stable tag: 1.8. 27 Version: 1.8.3 8 Stable tag: 1.8.3 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 40 40 41 41 > Questa è la lista completa di tutti gli aggiornamenti, test e correzioni. Ogni volta che una nuova versione viene rilasciata assicuratevi di aggiornare il prima possibile per usufruire delle ultime migliorie! 42 43 = 1.8.3 2026-01-19 = 44 * Bugfix minori e sicurezza 42 45 43 46 = 1.8.2 2025-12-05 =
Note: See TracChangeset
for help on using the changeset viewer.