Plugin Directory

Changeset 3337009


Ignore:
Timestamp:
07/31/2025 06:41:46 AM (7 months ago)
Author:
hideokamoto
Message:

Update to version 7.0.1 from GitHub

Location:
c3-cloudfront-clear-cache
Files:
34 added
4 deleted
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • c3-cloudfront-clear-cache/assets/banner-1544x500.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • c3-cloudfront-clear-cache/assets/banner-772x250.jpg

    • Property svn:mime-type changed from application/octet-stream to image/jpeg
  • c3-cloudfront-clear-cache/assets/icon-128x128.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • c3-cloudfront-clear-cache/assets/icon-256x256.jpg

    • Property svn:mime-type changed from application/octet-stream to image/jpeg
  • c3-cloudfront-clear-cache/tags/7.0.1/c3-cloudfront-clear-cache.php

    r3336321 r3337009  
    22/**
    33 * Plugin Name: C3 Cloudfront Cache Controller
    4  * Version: 7.0.0
     4 * Version: 7.0.1
    55 * Plugin URI:https://github.com/amimoto-ami/c3-cloudfront-clear-cache
    66 * Description: Manage CloudFront Cache and provide some fixtures.
  • c3-cloudfront-clear-cache/tags/7.0.1/classes/AWS/CloudFront_HTTP_Client.php

    r3336321 r3337009  
    224224        }
    225225
    226         libxml_use_internal_errors( true );
    227         libxml_disable_entity_loader( true );
    228         $xml = simplexml_load_string( $xml_body, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOENT );
    229 
    230         if ( false === $xml ) {
     226        try {
     227            $xml = $this->parse_aws_xml_with_simple_xml( $xml_body );
     228            return json_decode( json_encode( $xml ), true );
     229        } catch ( \Exception $e ) {
    231230            return array( 'raw_response' => $xml_body );
    232231        }
    233 
    234         return json_decode( json_encode( $xml ), true );
    235232    }
    236233
     
    243240     */
    244241    private function parse_error_response( $xml_body, $status_code ) {
     242        try {
     243            $xml = $this->parse_aws_xml_with_simple_xml( $xml_body );
     244            if ( isset( $xml->Message ) ) {
     245                return (string) $xml->Message;
     246            }
     247        } catch ( \Exception $e ) {
     248        }
     249
     250        return "CloudFront API error (HTTP {$status_code}): {$xml_body}";
     251    }
     252
     253    /**
     254     * Parse AWS XML response using SimpleXML with security measures
     255     * @param string $xml_string XML response string
     256     * @return SimpleXMLElement Parsed SimpleXMLElement
     257     * @throws InvalidArgumentException If XML string is empty
     258     * @throws RuntimeException If XML parsing fails
     259     */
     260    private function parse_aws_xml_with_simple_xml( $xml_string ) {
     261        if ( empty( $xml_string ) ) {
     262            throw new \InvalidArgumentException( 'Empty XML string provided for parsing' );
     263        }
     264
    245265        libxml_use_internal_errors( true );
    246         libxml_disable_entity_loader( true );
    247         $xml = simplexml_load_string( $xml_body, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOENT );
    248         if ( false !== $xml && isset( $xml->Message ) ) {
    249             return (string) $xml->Message;
    250         }
    251 
    252         return "CloudFront API error (HTTP {$status_code}): {$xml_body}";
     266       
     267        $xml = simplexml_load_string( $xml_string, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET | LIBXML_NOENT );
     268       
     269        if ( $xml === false ) {
     270            $errors = libxml_get_errors();
     271            $error_messages = array();
     272            foreach ( $errors as $error ) {
     273                $error_messages[] = sprintf(
     274                    'Line %d: %s',
     275                    $error->line,
     276                    trim( $error->message )
     277                );
     278            }
     279            libxml_clear_errors();
     280           
     281            $context = strlen( $xml_string ) > 200 ? substr( $xml_string, 0, 200 ) . '...' : $xml_string;
     282            throw new \RuntimeException(
     283                sprintf(
     284                    'XML parsing failed with errors: %s. XML content: %s',
     285                    implode( '; ', $error_messages ),
     286                    $context
     287                )
     288            );
     289        }
     290       
     291        libxml_clear_errors();
     292        return $xml;
    253293    }
    254294}
  • c3-cloudfront-clear-cache/tags/7.0.1/readme.txt

    r3336321 r3337009  
    55Requires at least: 4.9.0
    66Tested up to: 6.8.1
    7 Stable tag: 7.0.0
     7Stable tag: 7.0.1
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    9696== Changelog ==
    9797
     98== 7.0.1 ==
     99* [Update] Improved AWS API call processing for better security and PHP 8.x compatibility
     100
    98101== 7.0.0 ==
    99102* [Breaking Change] Remove AWS SDK dependency and implement custom HTTP CloudFront API client
  • c3-cloudfront-clear-cache/trunk/c3-cloudfront-clear-cache.php

    r3336321 r3337009  
    22/**
    33 * Plugin Name: C3 Cloudfront Cache Controller
    4  * Version: 7.0.0
     4 * Version: 7.0.1
    55 * Plugin URI:https://github.com/amimoto-ami/c3-cloudfront-clear-cache
    66 * Description: Manage CloudFront Cache and provide some fixtures.
  • c3-cloudfront-clear-cache/trunk/classes/AWS/CloudFront_HTTP_Client.php

    r3336321 r3337009  
    224224        }
    225225
    226         libxml_use_internal_errors( true );
    227         libxml_disable_entity_loader( true );
    228         $xml = simplexml_load_string( $xml_body, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOENT );
    229 
    230         if ( false === $xml ) {
     226        try {
     227            $xml = $this->parse_aws_xml_with_simple_xml( $xml_body );
     228            return json_decode( json_encode( $xml ), true );
     229        } catch ( \Exception $e ) {
    231230            return array( 'raw_response' => $xml_body );
    232231        }
    233 
    234         return json_decode( json_encode( $xml ), true );
    235232    }
    236233
     
    243240     */
    244241    private function parse_error_response( $xml_body, $status_code ) {
     242        try {
     243            $xml = $this->parse_aws_xml_with_simple_xml( $xml_body );
     244            if ( isset( $xml->Message ) ) {
     245                return (string) $xml->Message;
     246            }
     247        } catch ( \Exception $e ) {
     248        }
     249
     250        return "CloudFront API error (HTTP {$status_code}): {$xml_body}";
     251    }
     252
     253    /**
     254     * Parse AWS XML response using SimpleXML with security measures
     255     * @param string $xml_string XML response string
     256     * @return SimpleXMLElement Parsed SimpleXMLElement
     257     * @throws InvalidArgumentException If XML string is empty
     258     * @throws RuntimeException If XML parsing fails
     259     */
     260    private function parse_aws_xml_with_simple_xml( $xml_string ) {
     261        if ( empty( $xml_string ) ) {
     262            throw new \InvalidArgumentException( 'Empty XML string provided for parsing' );
     263        }
     264
    245265        libxml_use_internal_errors( true );
    246         libxml_disable_entity_loader( true );
    247         $xml = simplexml_load_string( $xml_body, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOENT );
    248         if ( false !== $xml && isset( $xml->Message ) ) {
    249             return (string) $xml->Message;
    250         }
    251 
    252         return "CloudFront API error (HTTP {$status_code}): {$xml_body}";
     266       
     267        $xml = simplexml_load_string( $xml_string, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET | LIBXML_NOENT );
     268       
     269        if ( $xml === false ) {
     270            $errors = libxml_get_errors();
     271            $error_messages = array();
     272            foreach ( $errors as $error ) {
     273                $error_messages[] = sprintf(
     274                    'Line %d: %s',
     275                    $error->line,
     276                    trim( $error->message )
     277                );
     278            }
     279            libxml_clear_errors();
     280           
     281            $context = strlen( $xml_string ) > 200 ? substr( $xml_string, 0, 200 ) . '...' : $xml_string;
     282            throw new \RuntimeException(
     283                sprintf(
     284                    'XML parsing failed with errors: %s. XML content: %s',
     285                    implode( '; ', $error_messages ),
     286                    $context
     287                )
     288            );
     289        }
     290       
     291        libxml_clear_errors();
     292        return $xml;
    253293    }
    254294}
  • c3-cloudfront-clear-cache/trunk/readme.txt

    r3336321 r3337009  
    55Requires at least: 4.9.0
    66Tested up to: 6.8.1
    7 Stable tag: 7.0.0
     7Stable tag: 7.0.1
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    9696== Changelog ==
    9797
     98== 7.0.1 ==
     99* [Update] Improved AWS API call processing for better security and PHP 8.x compatibility
     100
    98101== 7.0.0 ==
    99102* [Breaking Change] Remove AWS SDK dependency and implement custom HTTP CloudFront API client
Note: See TracChangeset for help on using the changeset viewer.