Conversation
validateDbName(), validateDbCollation() and validateTablePrefix() failed
only when preg_match() returned false, which happens on a regex error, not
on a mismatch - so they accepted anything. The values reach CREATE DATABASE
(the collation unquoted on MySQL), SELECT ... FROM {prefix}site_content and
the generated connection config.
- The three validators now require a match. Database names may start with a
digit and contain $ so existing databases still upgrade; collations may
contain @ (sr_RS@latin) or be empty.
- The connection test validates the collation, which it read raw, and
reports a rejected value as a failed check instead of a PHP fatal.
- install.php validates the table prefix it writes into the config.
validateDbUser() and validateAdminUsername() share the bug but only reach
PDO and the ORM; enforcing them would reject names in use today.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rocessor instprocessor.php is deprecated and no longer included (the store uses instprocessor-fast.php), but it still interpolated row ids and package event names into SQL. Ids are cast to int, event names escaped, and an undefined $dbase that made the tmplvar-templates DELETE invalid is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The web installer's identifier validators never rejected anything.
validateDbName(),validateDbCollation()andvalidateTablePrefix()failed only whenpreg_match(...) === false, which happens on a regex error, not on a mismatch (0). The unchecked values reached:CREATE DATABASE, where the collation went in unquoted on MySQLSELECT COUNT(*) FROM {prefix}site_contentin the connection test and summarycore/config/database/connections/default.php:install.phpwrote$_POST['tableprefix']without validating it at allThe installer only runs before a site is installed, with database credentials the person running it supplies, so the practical impact is limited. The checks were still no-ops.
Changes
[A-Za-z0-9_$-], up to 63 characters. A leading digit and$are accepted so existing databases still upgrade.@(PostgreSQLsr_RS@latin) or be empty.connection/databasetest.phpnow validates the collation, which it read raw. A rejected value is reported as the installer's red "failed!" status instead of a PHP fatal with a stack trace.install.phpvalidates the table prefix before writing it to the config.assets/modules/store/installer/instprocessor.php(deprecated, no longer included; the store usesinstprocessor-fast.php):$dbase.that made aDELETEinvalid is removedNot changed
validateDbUser()andvalidateAdminUsername()have the same=== falsebug. Their values only reach PDO and the ORM, not SQL text, and enforcing their current patterns would reject names in use today, such as DB users with-or.and email-style admin names. Worth a separate decision.Test plan
InstallerIdentifierValidationTest(34 tests): accepts real MySQL, PostgreSQL and SQLite names and collations; rejects quote, backtick,;, comment, path and PHP payloads; checks the call sites. 16 of these fail on3.5.x.tests/Unit/Installgreen.x; DROP TABLE evo_users; --as prefix,../../evilas name andutf8'; --as collation, and passesevo_/evolution/utf8.🤖 Generated with Claude Code