Skip to content

Commit d0bea6e

Browse files
committed
Merge remote-tracking branch 'kiro/develop' into develop
2 parents fd843ae + 01b900d commit d0bea6e

33 files changed

+558
-452
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
by the wordpress.org plugin guidelines.
5050
- Escape exception messages when
5151
`STATIC_DEPLOY_ESCAPE_EXCEPTIONS` is true.
52+
- Fix a security issue where the nonce was not verified
53+
for some actions until after the action had been performed.
5254

5355
## 9.3.2 (2025-07-29)
5456

bin/upgrade-deps

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
bin_dir="$(dirname "$0")"
6+
repo_root="$(realpath "$bin_dir"/..)"
7+
8+
"$bin_dir"/update-flakes
9+
10+
cd "$repo_root"
11+
composer upgrade
12+
13+
"$bin_dir"/update-hashes

composer.lock

Lines changed: 87 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/flake.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
pname = "${name}-composer-deps";
2525
version = "1.0.0";
2626
src = composerSrc;
27-
vendorHash = "sha256-OGd/3kXzSm0VP1SLlCymKnVgJ/U5Yt8xkKldGdErv74=";
27+
vendorHash = "sha256-KluG1kecPRaLEbOHc6BOu9shOoE6yg/fIyWeztKC3jE=";
2828
});
2929
composerVendorDev = php.mkComposerVendor (finalAttrs: {
3030
composerNoDev = false;
3131
pname = "${name}-composer-deps-dev";
3232
version = "1.0.0";
3333
src = composerSrc;
34-
vendorHash = "sha256-1quQI8iZqJ5LK3ADyuo9RW9SKhtewmZbGr68RLKMwu0=";
34+
vendorHash = "sha256-UexpJEq/ULTsR9ogPt1rDXqee9U7AjZQXQE1Xgemrts=";
3535
});
3636
staticDeploySrc = pkgs.lib.cleanSourceWith {
3737
src = self;

phpcs.xml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
-->
1111
<arg name="colors" />
1212
<arg name="tab-width" value="2" />
13-
<!-- Custom line length validation -->
1413
<rule ref="Squiz.PHP.DiscouragedFunctions" />
14+
<!-- Custom line length validation -->
1515
<rule ref="Generic.Files.LineLength">
1616
<properties>
1717
<property name="lineLimit" value="100" />
@@ -33,62 +33,34 @@
3333
<exclude name="Squiz.Commenting.LongConditionClosingComment"/>
3434
</rule>
3535
<rule ref="WordPress">
36-
<exclude name="Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed" />
3736
<exclude name="Generic.Commenting.DocComment.ShortNotCapital" />
3837
<exclude name="Generic.Commenting.DocComment.MissingShort" />
3938
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
4039
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
41-
<exclude name="Generic.PHP.NoSilencedErrors.Discouraged" />
42-
<exclude name="Generic.Strings.UnnecessaryStringConcat.Found" />
4340
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
44-
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
4541
<exclude name="Squiz.Commenting.ClassComment.Missing" />
46-
<exclude name="Squiz.Commenting.FileComment.Missing" />
4742
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
48-
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" />
4943
<exclude name="Squiz.Commenting.FunctionCommentThrowTag" />
5044
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
51-
<exclude name="Squiz.Commenting.LongConditionClosingComment.SpacingBefore" />
5245
<exclude name="Squiz.Commenting.PostStatementComment.Found" />
53-
<exclude name="Squiz.Commenting.VariableComment.Missing" />
5446
<exclude name="Squiz.PHP.CommentedOutCode.Found" />
5547
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" />
56-
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" />
57-
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterEnd" />
58-
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeOpen" />
5948
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
60-
<exclude name="Squiz.PHP.NonExecutableCode.Unreachable" />
6149
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
62-
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.Found" />
63-
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
6450
<exclude name="WordPress.DB.DirectDatabaseQuery.DirectQuery" />
6551
<exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching" />
6652
<exclude name="WordPress.DB.DirectDatabaseQuery.SchemaChange" />
67-
<exclude name="WordPress.DB.PreparedSQL" />
6853
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
6954
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
70-
<exclude name="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid" />
7155
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid" />
72-
<exclude name="WordPress.NamingConventions.ValidVariableName.MemberNotSnakeCase" />
73-
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCase" />
74-
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar" />
75-
<exclude name="WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting" />
7656
<exclude name="WordPress.PHP.DiscouragedPHPFunctions" />
77-
<!-- TODO: refactor to eliminate use of `exec` for compatibility w/shared hosts -->
78-
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec" />
79-
<!-- TODO: refactor to eliminate use of `shell_exec` for compat w/shared hosts -->
80-
<exclude name="WordPress.PHP.DontExtract.extract_extract" />
81-
<exclude name="WordPress.PHP.StrictComparisons.LooseComparison" />
82-
<exclude name="WordPress.PHP.StrictInArray.MissingTrueStrict" />
8357
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
8458
<!-- Forcing exceptions to be escaped is bad practice.
8559
See: https://github.com/WordPress/WordPress-Coding-Standards/issues/2374 -->
8660
<exclude name="WordPress.Security.EscapeOutput.ExceptionNotEscaped"/>
8761
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped" />
88-
<exclude name="WordPress.Security.NonceVerification" />
8962
<exclude name="WordPress.Security.ValidatedSanitizedInput" />
9063
<exclude name="WordPress.WP.AlternativeFunctions" />
91-
<exclude name="Generic.Arrays.DisallowShortArraySyntax" />
9264
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
9365
</rule>
9466
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>

src/Addons.php

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ public static function registerAddon(
3939

4040
global $wpdb;
4141

42-
$table_name = self::getTableName();
43-
44-
$sql = "INSERT IGNORE INTO {$table_name} (slug,type,name,docs_url,description)" .
45-
' VALUES (%s,%s,%s,%s,%s)';
46-
47-
$sql = $wpdb->prepare( $sql, $slug, $type, $name, $docs_url, $description );
48-
49-
$wpdb->query( $sql );
42+
$wpdb->query(
43+
$wpdb->prepare(
44+
'INSERT IGNORE INTO %i (slug,type,name,docs_url,description)' .
45+
' VALUES (%s,%s,%s,%s,%s)',
46+
self::getTableName(),
47+
$slug,
48+
$type,
49+
$name,
50+
$docs_url,
51+
$description,
52+
),
53+
);
5054
}
5155

5256
/**
@@ -59,17 +63,22 @@ public static function getAll( string $type = 'all' ): array {
5963

6064
$table_name = self::getTableName();
6165

62-
$query_string = "SELECT * FROM $table_name";
63-
$query_params = [];
6466
if ( $type !== 'all' ) {
65-
$query_string .= ' WHERE type = %s';
66-
$query_params[] = $type;
67+
return $wpdb->get_results(
68+
$wpdb->prepare(
69+
'SELECT * FROM %i WHERE type = %s ORDER BY type DESC',
70+
$table_name,
71+
$type
72+
)
73+
);
74+
} else {
75+
return $wpdb->get_results(
76+
$wpdb->prepare(
77+
'SELECT * FROM %i ORDER BY type DESC',
78+
$table_name
79+
)
80+
);
6781
}
68-
$query_string .= ' ORDER BY type DESC';
69-
70-
return $wpdb->get_results(
71-
$wpdb->prepare( $query_string, $query_params )
72-
);
7382
}
7483

7584
/**
@@ -81,14 +90,13 @@ public static function getAll( string $type = 'all' ): array {
8190
public static function getType( string $type ): array {
8291
global $wpdb;
8392

84-
$table_name = self::getTableName();
85-
86-
$query = $wpdb->prepare(
87-
"SELECT * FROM $table_name WHERE type = %s AND enabled = 1 ORDER BY slug",
88-
$type
93+
return $wpdb->get_results(
94+
$wpdb->prepare(
95+
'SELECT * FROM %i WHERE type = %s AND enabled = 1 ORDER BY slug',
96+
self::getTableName(),
97+
$type,
98+
),
8999
);
90-
91-
return $wpdb->get_results( $query );
92100
}
93101

94102
/**
@@ -99,7 +107,7 @@ public static function truncate(): void {
99107

100108
$table_name = self::getTableName();
101109

102-
$wpdb->query( "TRUNCATE TABLE $table_name" );
110+
$wpdb->query( $wpdb->prepare( 'TRUNCATE TABLE %i', $table_name ) );
103111

104112
WsLog::l( 'Deregistered all Addons' );
105113
}

src/AdminBar.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function afterAdminBarRender(): void {
7171
$ajax_job_queue_url = Controller::getAdminAjaxUrl( 'job_queue' );
7272
?>
7373
<script>
74-
var static_deploy_job_queue_url = "<?php echo esc_url( $ajax_job_queue_url ); ?>";
74+
var static_deploy_job_queue_url = "<?php echo esc_js( $ajax_job_queue_url ); ?>";
7575
var static_deploy_last_interval = 30000;
7676
var static_deploy_job_type_labels = {
7777
detect: "Detecting URLs",
@@ -213,8 +213,10 @@ public static function getJobsInProgress(): array {
213213
$table_name = JobQueue::getTableName();
214214

215215
return $wpdb->get_results(
216-
"SELECT * FROM $table_name
217-
WHERE status = 'processing'"
216+
$wpdb->prepare(
217+
"SELECT * FROM %i WHERE status = 'processing'",
218+
$table_name
219+
)
218220
);
219221
}
220222

src/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function options(
259259
$value = $args[2] ?? null;
260260
$reveal_sensitive_values = isset( $assoc_args['reveal-sensitive-values'] );
261261

262-
if ( ! in_array( $action, [ 'get', 'set', 'list' ] ) ) {
262+
if ( ! in_array( $action, [ 'get', 'set', 'list' ], true ) ) {
263263
WP_CLI::error( 'Missing required argument: <get|set|list>' );
264264
}
265265

0 commit comments

Comments
 (0)