Changeset 3337009
- Timestamp:
- 07/31/2025 06:41:46 AM (7 months ago)
- Location:
- c3-cloudfront-clear-cache
- Files:
-
- 34 added
- 4 deleted
- 10 edited
- 1 copied
-
assets/banner-1544x500.png (modified) (1 prop) (previous)
-
assets/banner-772x250.jpg (modified) (1 prop) (previous)
-
assets/icon-128x128.png (modified) (1 prop) (previous)
-
assets/icon-256x256.jpg (modified) (1 prop) (previous)
-
tags/7.0.1 (copied) (copied from c3-cloudfront-clear-cache/trunk)
-
tags/7.0.1/.cursor (added)
-
tags/7.0.1/.cursor/rules (added)
-
tags/7.0.1/.cursor/rules/c3-cloudfront-cache-implementation.mdc (added)
-
tags/7.0.1/.github (added)
-
tags/7.0.1/.github/workflows (added)
-
tags/7.0.1/.github/workflows/deploy-docs.yml (added)
-
tags/7.0.1/.github/workflows/docs.yml (added)
-
tags/7.0.1/.github/workflows/push-asset-readme-update.yml (added)
-
tags/7.0.1/.github/workflows/push-deploy.yml (added)
-
tags/7.0.1/.github/workflows/test.yml (added)
-
tags/7.0.1/.wordpress-org (added)
-
tags/7.0.1/.wordpress-org/banner-1544x500.png (added)
-
tags/7.0.1/.wordpress-org/banner-772x250.jpg (added)
-
tags/7.0.1/.wordpress-org/icon-128x128.png (added)
-
tags/7.0.1/.wordpress-org/icon-256x256.jpg (added)
-
tags/7.0.1/.wp-env.json (added)
-
tags/7.0.1/c3-cloudfront-clear-cache.php (modified) (1 diff)
-
tags/7.0.1/classes/AWS/CloudFront_HTTP_Client.php (modified) (2 diffs)
-
tags/7.0.1/composer.json (deleted)
-
tags/7.0.1/package.json (deleted)
-
tags/7.0.1/readme.txt (modified) (2 diffs)
-
tags/7.0.1/renovate.json (added)
-
trunk/.cursor (added)
-
trunk/.cursor/rules (added)
-
trunk/.cursor/rules/c3-cloudfront-cache-implementation.mdc (added)
-
trunk/.github (added)
-
trunk/.github/workflows (added)
-
trunk/.github/workflows/deploy-docs.yml (added)
-
trunk/.github/workflows/docs.yml (added)
-
trunk/.github/workflows/push-asset-readme-update.yml (added)
-
trunk/.github/workflows/push-deploy.yml (added)
-
trunk/.github/workflows/test.yml (added)
-
trunk/.wordpress-org (added)
-
trunk/.wordpress-org/banner-1544x500.png (added)
-
trunk/.wordpress-org/banner-772x250.jpg (added)
-
trunk/.wordpress-org/icon-128x128.png (added)
-
trunk/.wordpress-org/icon-256x256.jpg (added)
-
trunk/.wp-env.json (added)
-
trunk/c3-cloudfront-clear-cache.php (modified) (1 diff)
-
trunk/classes/AWS/CloudFront_HTTP_Client.php (modified) (2 diffs)
-
trunk/composer.json (deleted)
-
trunk/package.json (deleted)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/renovate.json (added)
Legend:
- Unmodified
- Added
- Removed
-
c3-cloudfront-clear-cache/assets/banner-1544x500.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
c3-cloudfront-clear-cache/assets/banner-772x250.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
c3-cloudfront-clear-cache/assets/icon-128x128.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
c3-cloudfront-clear-cache/assets/icon-256x256.jpg
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/jpeg
-
Property
svn:mime-type
changed from
-
c3-cloudfront-clear-cache/tags/7.0.1/c3-cloudfront-clear-cache.php
r3336321 r3337009 2 2 /** 3 3 * Plugin Name: C3 Cloudfront Cache Controller 4 * Version: 7.0. 04 * Version: 7.0.1 5 5 * Plugin URI:https://github.com/amimoto-ami/c3-cloudfront-clear-cache 6 6 * Description: Manage CloudFront Cache and provide some fixtures. -
c3-cloudfront-clear-cache/tags/7.0.1/classes/AWS/CloudFront_HTTP_Client.php
r3336321 r3337009 224 224 } 225 225 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 ) { 231 230 return array( 'raw_response' => $xml_body ); 232 231 } 233 234 return json_decode( json_encode( $xml ), true );235 232 } 236 233 … … 243 240 */ 244 241 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 245 265 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; 253 293 } 254 294 } -
c3-cloudfront-clear-cache/tags/7.0.1/readme.txt
r3336321 r3337009 5 5 Requires at least: 4.9.0 6 6 Tested up to: 6.8.1 7 Stable tag: 7.0. 07 Stable tag: 7.0.1 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 96 96 == Changelog == 97 97 98 == 7.0.1 == 99 * [Update] Improved AWS API call processing for better security and PHP 8.x compatibility 100 98 101 == 7.0.0 == 99 102 * [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 2 2 /** 3 3 * Plugin Name: C3 Cloudfront Cache Controller 4 * Version: 7.0. 04 * Version: 7.0.1 5 5 * Plugin URI:https://github.com/amimoto-ami/c3-cloudfront-clear-cache 6 6 * Description: Manage CloudFront Cache and provide some fixtures. -
c3-cloudfront-clear-cache/trunk/classes/AWS/CloudFront_HTTP_Client.php
r3336321 r3337009 224 224 } 225 225 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 ) { 231 230 return array( 'raw_response' => $xml_body ); 232 231 } 233 234 return json_decode( json_encode( $xml ), true );235 232 } 236 233 … … 243 240 */ 244 241 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 245 265 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; 253 293 } 254 294 } -
c3-cloudfront-clear-cache/trunk/readme.txt
r3336321 r3337009 5 5 Requires at least: 4.9.0 6 6 Tested up to: 6.8.1 7 Stable tag: 7.0. 07 Stable tag: 7.0.1 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 96 96 == Changelog == 97 97 98 == 7.0.1 == 99 * [Update] Improved AWS API call processing for better security and PHP 8.x compatibility 100 98 101 == 7.0.0 == 99 102 * [Breaking Change] Remove AWS SDK dependency and implement custom HTTP CloudFront API client
Note: See TracChangeset
for help on using the changeset viewer.