Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@
$size_key = floor( log( (float) $row['Size'] ) / log( 1000 ) );
$sizes = [ 'B', 'KB', 'MB', 'GB', 'TB' ];

$size_format = isset( $sizes[ $size_key ] ) ? $sizes[ $size_key ] : $sizes[0];

Check failure on line 1164 in src/DB_Command.php

View workflow job for this annotation

GitHub Actions / code-quality / PHPStan

Invalid array key type float.

Check failure on line 1164 in src/DB_Command.php

View workflow job for this annotation

GitHub Actions / code-quality / PHPStan

Invalid array key type float.
}

// Display the database size as a number.
Expand Down Expand Up @@ -1835,6 +1835,11 @@
$required['default-character-set'] = constant( 'DB_CHARSET' );
}

// Add --ssl-verify-server-cert for MariaDB to suppress passwordless login warning.
if ( 'mariadb' === Utils\get_db_type() && ! isset( $assoc_args['ssl-verify-server-cert'] ) ) {
$required['ssl-verify-server-cert'] = true;
}
Comment on lines +1839 to +1841

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change correctly suppresses the MariaDB warnings and improves the default security posture. However, it's worth noting that this introduces a potential breaking change for users on MariaDB with passwordless logins and an invalid or untrusted server SSL certificate. Previously, their commands would succeed with a warning; now, they will fail due to the enforced SSL verification.

While users can opt-out by using --no-ssl-verify-server-cert, this change in default behavior could be surprising. I'd recommend adding a note about this to the relevant command documentation or the project's release notes to ensure users are aware of the change and how to manage it.


// Using 'dbuser' as option name to workaround clash with WP-CLI's global WP 'user' parameter, with 'dbpass' also available for tidiness.
if ( isset( $assoc_args['dbuser'] ) ) {
$required['user'] = $assoc_args['dbuser'];
Expand Down Expand Up @@ -2075,6 +2080,7 @@
'ssl-fips-mode',
'ssl-key',
'ssl-mode',
'ssl-verify-server-cert',
'syslog',
'table',
'tee',
Expand Down
Loading