Skip to content

Commit 2121e08

Browse files
authored
Merge pull request #6080 from Automattic/staging
Production release: v20250107.0
2 parents bdc8e59 + 38cbe91 commit 2121e08

File tree

6 files changed

+182
-137
lines changed

6 files changed

+182
-137
lines changed

.github/actions/run-wp-tests/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ runs:
122122
"${PHPUNIT}" ${OPTIONS}
123123
124124
- name: Upload coverage report
125-
uses: codecov/codecov-action@v5.0.7
125+
uses: codecov/codecov-action@v5.1.1
126126
with:
127127
files: ${{ inputs.coverage-file }}
128128
flags: ${{ inputs.coverage-flags }}

.github/workflows/codeql-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
uses: actions/[email protected]
3333

3434
- name: Initialize CodeQL
35-
uses: github/codeql-action/[email protected].5
35+
uses: github/codeql-action/[email protected].6
3636
with:
3737
languages: ${{ matrix.language }}
3838
config-file: ./.github/codeql-config.yml
3939

4040
- name: Perform CodeQL Analysis
41-
uses: github/codeql-action/[email protected].5
41+
uses: github/codeql-action/[email protected].6

files/acl/acl.php

+21-14
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,32 @@ function get_option_as_bool_if_exists( $option_name ) {
7272
/**
7373
* Check if the path is allowed for the current context.
7474
*
75-
* @param string $file_path Path to the file, minus the `/wp-content/uploads/` bit. It's the second portion returned by `Pre_Wp_Utils\prepare_request()`
75+
* @param string $file_path Path to the file, minus the `/wp-content/uploads/` bit.
76+
* This is the second portion returned by `Pre_Wp_Utils\prepare_request()`.
77+
* @return bool True if the file path is valid for the current site, false otherwise.
7678
*/
7779
function is_valid_path_for_site( $file_path ) {
78-
if ( ! is_multisite() ) {
79-
return true;
80-
}
81-
82-
// If main site, don't allow access to /sites/ subdirectories.
83-
if ( is_main_network() && is_main_site() ) {
84-
if ( 0 === strpos( $file_path, 'sites/' ) ) {
85-
return false;
80+
$is_valid = true;
81+
82+
if ( is_multisite() ) {
83+
// If main site, don't allow access to `/sites/` subdirectories.
84+
if ( is_main_network() && is_main_site() ) {
85+
$is_valid = ! str_starts_with( $file_path, 'sites/' );
86+
} else {
87+
// Check if the file path matches the current site ID's directory.
88+
$base_path = sprintf( 'sites/%d', get_current_blog_id() );
89+
$is_valid = str_starts_with( $file_path, $base_path );
8690
}
87-
88-
return true;
8991
}
9092

91-
$base_path = sprintf( 'sites/%d', get_current_blog_id() );
92-
93-
return 0 === strpos( $file_path, $base_path );
93+
/**
94+
* Filter the result of the path validation for the current site.
95+
* Allows to override the logic used to determine if a file path is valid for the current site.
96+
*
97+
* @param bool $is_valid Whether the file path is valid for the current site.
98+
* @param string $file_path Path to the file, minus the `/wp-content/uploads/` bit.
99+
*/
100+
return apply_filters( 'vip_files_acl_is_valid_path_for_site', $is_valid, $file_path );
94101
}
95102

96103
/**

package-lock.json

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)