Changeset 3699076 for nextgen-gallery/trunk/src/DisplayType/Controller.php
- Timestamp:
- 09/16/2026 06:00:14 PM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nextgen-gallery/trunk/src/DisplayType/Controller.php
r3680435 r3699076 475 475 } 476 476 477 $storage = StorageManager::get_instance(); 478 477 479 foreach ( $dirs as $category => $dir ) { 478 480 $category = preg_quote( $category . DIRECTORY_SEPARATOR, '#' ); … … 480 482 $display_type_view = $match[1]; 481 483 $template_abspath = $fs->join_paths( $dir, $display_type_view ); 484 485 // join_paths() preserves "..", and this value comes from the gallery's stored 486 // display_type_settings, which remote-editing endpoints can write. Without a 487 // containment check, "default/../../../../uploads/2026/01/x.jpg" resolves here 488 // and View::render() include()s whatever it points at. The refused case falls 489 // through to the built-in template rather than failing the render. 490 if ( ! $storage->is_path_contained( $dir, $template_abspath ) ) { 491 $storage->log_path_refusal( 492 sprintf( 493 'NextGEN Gallery: refused display template "%s" for display type "%s" - resolves outside the template directory (%s)', 494 $template_abspath, 495 $display_type_name, 496 $dir 497 ), 498 StorageManager::REFUSAL_TEMPLATE_PATH 499 ); 500 continue; 501 } 502 482 503 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 483 504 if ( @file_exists( $template_abspath ) ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)