Skip to content

Commit 3e72a74

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 7686376 + 12c69be commit 3e72a74

File tree

330 files changed

+6364
-4024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

330 files changed

+6364
-4024
lines changed

.github/workflows/coding-standards.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ jobs:
8282
- name: Cache PHPCS scan cache
8383
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
8484
with:
85-
path: .cache/phpcs.json
85+
path: |
86+
.cache/phpcs-src.json
87+
.cache/phpcs-tests.json
8688
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
8789

8890
# Since Composer dependencies are installed using `composer update` and no lock file is in version control,
@@ -97,15 +99,15 @@ jobs:
9799

98100
- name: Run PHPCS on all Core files
99101
id: phpcs-core
100-
run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml
102+
run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml
101103

102104
- name: Show PHPCS results in PR
103105
if: ${{ always() && steps.phpcs-core.outcome == 'failure' }}
104106
run: cs2pr ./.cache/phpcs-report.xml
105107

106108
- name: Check test suite files for warnings
107109
id: phpcs-tests
108-
run: phpcs tests --report-full --report-checkstyle=./.cache/phpcs-tests-report.xml
110+
run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml
109111

110112
- name: Show test suite scan results in PR
111113
if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }}

.github/workflows/phpunit-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,8 @@ jobs:
197197
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
198198

199199
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
200-
# This test group is not (yet) run against PHP 8.2 as there is no stable Xdebug version available yet for PHP 8.2.
201200
- name: Run (Xdebug) tests
202-
if: ${{ ! matrix.split_slow && matrix.php != '8.2' }}
201+
if: ${{ ! matrix.split_slow }}
203202
run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__
204203

205204
- name: Ensure version-controlled files are not modified or deleted

.github/workflows/test-old-branches.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ jobs:
3030
branch: [
3131
'6.1','6.0',
3232
'5.9', '5.8', '5.7', '5.6', '5.5', '5.4', '5.3', '5.2', '5.1', '5.0',
33-
'4.9', '4.8', '4.7', '4.6', '4.5', '4.4', '4.3', '4.2', '4.1', '4.0',
34-
'3.9', '3.8', '3.7'
33+
'4.9', '4.8', '4.7', '4.6', '4.5', '4.4', '4.3', '4.2', '4.1'
3534
]
3635
include:
3736
# PHP Compatibility testing was introduced in 5.5.
@@ -61,12 +60,6 @@ jobs:
6160
workflow: 'end-to-end-tests.yml'
6261
- branch: '5.8'
6362
workflow: 'end-to-end-tests.yml'
64-
exclude:
65-
# Coding standards and JavaScript testing did not take place in 3.7.
66-
- branch: '3.7'
67-
workflow: 'coding-standards.yml'
68-
- branch: '3.7'
69-
workflow: 'javascript-tests.yml'
7063

7164
# Run all branches monthly, but only the currently supported one twice per month.
7265
steps:

SECURITY.md

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,46 @@ Full details of the WordPress Security Policy can be found on [HackerOne](https:
77
Use this section to tell people about which versions of your project are
88
currently being supported with security updates.
99

10-
| Version | Supported |
11-
| ------- | ------------------ |
12-
| 6.1.x | :white_check_mark: |
13-
| 6.0.x | :white_check_mark: |
14-
| 5.9.x | :white_check_mark: |
15-
| 5.8.x | :white_check_mark: |
16-
| 5.7.x | :white_check_mark: |
17-
| 5.6.x | :white_check_mark: |
18-
| 5.5.x | :white_check_mark: |
19-
| 5.4.x | :white_check_mark: |
20-
| 5.3.x | :white_check_mark: |
21-
| 5.2.x | :white_check_mark: |
22-
| 5.1.x | :white_check_mark: |
23-
| 5.0.x | :white_check_mark: |
24-
| 4.9.x | :white_check_mark: |
25-
| 4.8.x | :white_check_mark: |
26-
| 4.7.x | :white_check_mark: |
27-
| 4.6.x | :white_check_mark: |
28-
| 4.5.x | :white_check_mark: |
29-
| 4.4.x | :white_check_mark: |
30-
| 4.3.x | :white_check_mark: |
31-
| 4.2.x | :white_check_mark: |
32-
| 4.1.x | :white_check_mark: |
33-
| 4.0.x | :white_check_mark: |
34-
| 3.9.x | :white_check_mark: |
35-
| 3.8.x | :white_check_mark: |
36-
| 3.7.x | :white_check_mark: |
37-
| < 3.7.0 | :x: |
10+
| Version | Supported |
11+
| ------- | --------- |
12+
| 6.1.x | Yes |
13+
| 6.0.x | Yes |
14+
| 5.9.x | Yes |
15+
| 5.8.x | Yes |
16+
| 5.7.x | Yes |
17+
| 5.6.x | Yes |
18+
| 5.5.x | Yes |
19+
| 5.4.x | Yes |
20+
| 5.3.x | Yes |
21+
| 5.2.x | Yes |
22+
| 5.1.x | Yes |
23+
| 5.0.x | Yes |
24+
| 4.9.x | Yes |
25+
| 4.8.x | Yes |
26+
| 4.7.x | Yes |
27+
| 4.6.x | Yes |
28+
| 4.5.x | Yes |
29+
| 4.4.x | Yes |
30+
| 4.3.x | Yes |
31+
| 4.2.x | Yes |
32+
| 4.1.x | Yes |
33+
| < 4.1.0 | No |
3834

3935
## Reporting a Vulnerability
4036

41-
[<span>WordPress</span>](https://wordpress.org/) is an open-source publishing platform. Our HackerOne program covers the Core software, as well as a variety of related projects and infrastructure.
37+
[WordPress](https://wordpress.org/) is an open-source publishing platform. Our HackerOne program covers the Core software, as well as a variety of related projects and infrastructure.
4238

4339
Our most critical targets are:
4440

45-
* WordPress Core [<span>software</span>](https://wordpress.org/download/source/), [<span>API</span>](https://codex.wordpress.org/WordPress.org_API), and [<span>website</span>](https://wordpress.org/).
46-
* Gutenberg [<span>software</span>](https://github.com/WordPress/gutenberg/) and Classic Editor [<span>software</span>](https://wordpress.org/plugins/classic-editor/).
47-
* WP-CLI [<span>software</span>](https://github.com/wp-cli/) and [<span>website</span>](https://wp-cli.org/).
48-
* BuddyPress [<span>software</span>](https://buddypress.org/download/) and [<span>website</span>](https://buddypress.org/).
49-
* bbPress [<span>software</span>](https://bbpress.org/download/) and [<span>website</span>](https://bbpress.org/).
50-
* GlotPress [<span>software</span>](https://github.com/glotpress/glotpress-wp) (but not the website).
51-
* WordCamp.org [<span>website</span>](https://central.wordcamp.org).
41+
* WordPress Core [software](https://wordpress.org/download/source/), [API](https://codex.wordpress.org/WordPress.org_API), and [website](https://wordpress.org/).
42+
* Gutenberg [software](https://github.com/WordPress/gutenberg/) and Classic Editor [software](https://wordpress.org/plugins/classic-editor/).
43+
* WP-CLI [software](https://github.com/wp-cli/) and [website](https://wp-cli.org/).
44+
* BuddyPress [software](https://buddypress.org/download/) and [website](https://buddypress.org/).
45+
* bbPress [software](https://bbpress.org/download/) and [website](https://bbpress.org/).
46+
* GlotPress [software](https://github.com/glotpress/glotpress-wp) (but not the website).
47+
* WordCamp.org [website](https://central.wordcamp.org).
5248

53-
Source code for most websites can be found in the Meta repository (`git clone git://meta.git.wordpress.org/`). [<span>The Meta Environment</span>](https://github.com/WordPress/meta-environment) will automatically provision a local copy of some sites for you.
49+
Source code for most websites can be found in the Meta repository (`git clone git://meta.git.wordpress.org/`). [The Meta Environment](https://github.com/WordPress/meta-environment) will automatically provision a local copy of some sites for you.
5450

5551
For more targets, see the `In Scope` section below.
5652

@@ -62,14 +58,14 @@ Any reproducible vulnerability that has a severe effect on the security or priva
6258

6359
We generally **aren’t** interested in the following problems:
6460

65-
* Any vulnerability with a [<span>CVSS 3</span>](https://www.first.org/cvss/calculator/3.0) score lower than `4.0`, unless it can be combined with other vulnerabilities to achieve a higher score.
61+
* Any vulnerability with a [CVSS 3](https://www.first.org/cvss/calculator/3.0) score lower than `4.0`, unless it can be combined with other vulnerabilities to achieve a higher score.
6662
* Brute force, DoS, phishing, text injection, or social engineering attacks. Wikis, Tracs, forums, etc are intended to allow users to edit them.
67-
* Security vulnerabilities in WordPress plugins not _specifically_ listed as an in-scope asset. Out of scope plugins can be [<span>reported to the Plugin Review team</span>](https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/#how-can-i-send-a-security-report).
68-
* Reports for hacked websites. The site owner can [<span>learn more about restoring their site</span>](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#ive-been-hacked-what-do-i-do-now).
69-
* [<span>Users with administrator or editor privileges can post arbitrary JavaScript</span>](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-some-users-allowed-to-post-unfiltered-html)
70-
* [<span>Disclosure of user IDs</span>](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-disclosures-of-usernames-or-user-ids-not-a-security-issue)
71-
* Open API endpoints serving public data (Including [<span>usernames and user IDs</span>](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-disclosures-of-usernames-or-user-ids-not-a-security-issue))
72-
* [<span>Path disclosures for errors, warnings, or notices</span>](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-there-path-disclosures-when-directly-loading-certain-files)
63+
* Security vulnerabilities in WordPress plugins not _specifically_ listed as an in-scope asset. Out of scope plugins can be [reported to the Plugin Review team](https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/#how-can-i-send-a-security-report).
64+
* Reports for hacked websites. The site owner can [learn more about restoring their site](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#ive-been-hacked-what-do-i-do-now).
65+
* [Users with administrator or editor privileges can post arbitrary JavaScript](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-some-users-allowed-to-post-unfiltered-html)
66+
* [Disclosure of user IDs](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-disclosures-of-usernames-or-user-ids-not-a-security-issue)
67+
* Open API endpoints serving public data (Including [usernames and user IDs](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-disclosures-of-usernames-or-user-ids-not-a-security-issue))
68+
* [Path disclosures for errors, warnings, or notices](https://make.wordpress.org/core/handbook/testing/reporting-security-vulnerabilities/#why-are-there-path-disclosures-when-directly-loading-certain-files)
7369
* WordPress version number disclosure
7470
* Mixed content warnings for passive assets like images and videos
7571
* Lack of HTTP security headers (CSP, X-XSS, etc.)
@@ -83,7 +79,7 @@ We generally **aren’t** interested in the following problems:
8379

8480
We're committed to working with security researchers to resolve the vulnerabilities they discover. You can help us by following these guidelines:
8581

86-
* Follow [<span>HackerOne's disclosure guidelines</span>](https://www.hackerone.com/disclosure-guidelines).
82+
* Follow [HackerOne's disclosure guidelines](https://www.hackerone.com/disclosure-guidelines).
8783
* Pen-testing Production:
8884
* Please **setup a local environment** instead whenever possible. Most of our code is open source (see above).
8985
* If that's not possible, **limit any data access/modification** to the bare minimum necessary to reproduce a PoC.

src/js/_enqueues/admin/inline-edit-post.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ window.wp = window.wp || {};
305305
if ( !$(':input[name="post_author"] option[value="' + $('.post_author', rowData).text() + '"]', editRow).val() ) {
306306

307307
// The post author no longer has edit capabilities, so we need to add them to the list of authors.
308-
$(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#' + t.type + '-' + id + ' .author').text() + '</option>');
308+
$(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#post-' + id + ' .author').text() + '</option>');
309309
}
310310
if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) {
311311
$('label.inline-edit-author', editRow).hide();

src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.js

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* imgAreaSelect jQuery plugin
3-
* version 0.9.10-wp
3+
* version 0.9.10-wp-6.2
44
*
55
* Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net)
66
*
@@ -20,7 +20,7 @@
2020
var abs = Math.abs,
2121
max = Math.max,
2222
min = Math.min,
23-
round = Math.round;
23+
floor = Math.floor;
2424

2525
/**
2626
* Create a new HTML div element
@@ -230,12 +230,12 @@ $.imgAreaSelect = function (img, options) {
230230
function getSelection(noScale) {
231231
var sx = noScale || scaleX, sy = noScale || scaleY;
232232

233-
return { x1: round(selection.x1 * sx),
234-
y1: round(selection.y1 * sy),
235-
x2: round(selection.x2 * sx),
236-
y2: round(selection.y2 * sy),
237-
width: round(selection.x2 * sx) - round(selection.x1 * sx),
238-
height: round(selection.y2 * sy) - round(selection.y1 * sy) };
233+
return { x1: floor(selection.x1 * sx),
234+
y1: floor(selection.y1 * sy),
235+
x2: floor(selection.x2 * sx),
236+
y2: floor(selection.y2 * sy),
237+
width: floor(selection.x2 * sx) - floor(selection.x1 * sx),
238+
height: floor(selection.y2 * sy) - floor(selection.y1 * sy) };
239239
}
240240

241241
/**
@@ -257,10 +257,10 @@ $.imgAreaSelect = function (img, options) {
257257
var sx = noScale || scaleX, sy = noScale || scaleY;
258258

259259
selection = {
260-
x1: round(x1 / sx || 0),
261-
y1: round(y1 / sy || 0),
262-
x2: round(x2 / sx || 0),
263-
y2: round(y2 / sy || 0)
260+
x1: floor(x1 / sx || 0),
261+
y1: floor(y1 / sy || 0),
262+
x2: floor(x2 / sx || 0),
263+
y2: floor(y2 / sy || 0)
264264
};
265265

266266
selection.width = selection.x2 - selection.x1;
@@ -283,7 +283,7 @@ $.imgAreaSelect = function (img, options) {
283283
* Get image offset. The .offset() method returns float values, so they
284284
* need to be rounded.
285285
*/
286-
imgOfs = { left: round($img.offset().left), top: round($img.offset().top) };
286+
imgOfs = { left: floor($img.offset().left), top: floor($img.offset().top) };
287287

288288
/* Get image dimensions */
289289
imgWidth = $img.innerWidth();
@@ -293,10 +293,10 @@ $.imgAreaSelect = function (img, options) {
293293
imgOfs.left += ($img.outerWidth() - imgWidth) >> 1;
294294

295295
/* Set minimum and maximum selection area dimensions */
296-
minWidth = round(options.minWidth / scaleX) || 0;
297-
minHeight = round(options.minHeight / scaleY) || 0;
298-
maxWidth = round(min(options.maxWidth / scaleX || 1<<24, imgWidth));
299-
maxHeight = round(min(options.maxHeight / scaleY || 1<<24, imgHeight));
296+
minWidth = floor(options.minWidth / scaleX) || 0;
297+
minHeight = floor(options.minHeight / scaleY) || 0;
298+
maxWidth = floor(min(options.maxWidth / scaleX || 1<<24, imgWidth));
299+
maxHeight = floor(min(options.maxHeight / scaleY || 1<<24, imgHeight));
300300

301301
/*
302302
* Workaround for jQuery 1.3.2 incorrect offset calculation, originally
@@ -311,8 +311,8 @@ $.imgAreaSelect = function (img, options) {
311311

312312
/* Determine parent element offset */
313313
parOfs = /absolute|relative/.test($parent.css('position')) ?
314-
{ left: round($parent.offset().left) - $parent.scrollLeft(),
315-
top: round($parent.offset().top) - $parent.scrollTop() } :
314+
{ left: floor($parent.offset().left) - $parent.scrollLeft(),
315+
top: floor($parent.offset().top) - $parent.scrollTop() } :
316316
position == 'fixed' ?
317317
{ left: $(document).scrollLeft(), top: $(document).scrollTop() } :
318318
{ left: 0, top: 0 };
@@ -430,6 +430,13 @@ $.imgAreaSelect = function (img, options) {
430430
function doUpdate(resetKeyPress) {
431431
adjust();
432432
update(resetKeyPress);
433+
updateSelectionRelativeToParentElement();
434+
}
435+
436+
/**
437+
* Set the correct values of x1, y1, x2, and y2.
438+
*/
439+
function updateSelectionRelativeToParentElement() {
433440
x1 = viewX(selection.x1); y1 = viewY(selection.y1);
434441
x2 = viewX(selection.x2); y2 = viewY(selection.y2);
435442
}
@@ -571,16 +578,16 @@ $.imgAreaSelect = function (img, options) {
571578
if (xFirst) {
572579
x2 = max(left, min(left + imgWidth,
573580
x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1)));
574-
y2 = round(max(top, min(top + imgHeight,
581+
y2 = floor(max(top, min(top + imgHeight,
575582
y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1))));
576-
x2 = round(x2);
583+
x2 = floor(x2);
577584
}
578585
else {
579586
y2 = max(top, min(top + imgHeight,
580587
y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1)));
581-
x2 = round(max(left, min(left + imgWidth,
588+
x2 = floor(max(left, min(left + imgWidth,
582589
x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1))));
583-
y2 = round(y2);
590+
y2 = floor(y2);
584591
}
585592
}
586593

@@ -589,6 +596,14 @@ $.imgAreaSelect = function (img, options) {
589596
* aspect ratio
590597
*/
591598
function doResize() {
599+
/*
600+
* Make sure x1, x2, y1, y2 are initialized to avoid the following calculation
601+
* getting incorrect results.
602+
*/
603+
if ( x1 == null || x2 == null || y1 == null || y2 == null ) {
604+
updateSelectionRelativeToParentElement();
605+
}
606+
592607
/*
593608
* Make sure the top left corner of the selection area stays within
594609
* image boundaries (it might not if the image source was dynamically

0 commit comments

Comments
 (0)