mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
fix: Fix psalm taint false-positive by escaping trusted input
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
fa108d5b54
commit
7c907223d2
2 changed files with 11 additions and 19 deletions
|
|
@ -49,12 +49,4 @@
|
|||
<code><![CDATA[$column]]></code>
|
||||
</TaintedSql>
|
||||
</file>
|
||||
<file src="lib/public/IDBConnection.php">
|
||||
<TaintedSql>
|
||||
<code><![CDATA[$sql]]></code>
|
||||
<code><![CDATA[$sql]]></code>
|
||||
<code><![CDATA[$sql]]></code>
|
||||
<code><![CDATA[$sql]]></code>
|
||||
</TaintedSql>
|
||||
</file>
|
||||
</files>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class MySQL extends AbstractDatabase {
|
|||
/**
|
||||
* @param \OC\DB\Connection $connection
|
||||
*/
|
||||
private function createDatabase($connection) {
|
||||
private function createDatabase($connection): void {
|
||||
try {
|
||||
$name = $this->dbName;
|
||||
$user = $this->dbUser;
|
||||
|
|
@ -91,7 +91,7 @@ class MySQL extends AbstractDatabase {
|
|||
* @param IDBConnection $connection
|
||||
* @throws \OC\DatabaseSetupException
|
||||
*/
|
||||
private function createDBUser($connection) {
|
||||
private function createDBUser($connection): void {
|
||||
try {
|
||||
$name = $this->dbUser;
|
||||
$password = $this->dbPassword;
|
||||
|
|
@ -99,15 +99,15 @@ class MySQL extends AbstractDatabase {
|
|||
// the anonymous user would take precedence when there is one.
|
||||
|
||||
if ($connection->getDatabasePlatform() instanceof Mysql80Platform) {
|
||||
$query = "CREATE USER '$name'@'localhost' IDENTIFIED WITH mysql_native_password BY '$password'";
|
||||
$connection->executeUpdate($query);
|
||||
$query = "CREATE USER '$name'@'%' IDENTIFIED WITH mysql_native_password BY '$password'";
|
||||
$connection->executeUpdate($query);
|
||||
$query = "CREATE USER ?@'localhost' IDENTIFIED WITH mysql_native_password BY ?";
|
||||
$connection->executeUpdate($query, [$name,$password]);
|
||||
$query = "CREATE USER ?@'%' IDENTIFIED WITH mysql_native_password BY ?";
|
||||
$connection->executeUpdate($query, [$name,$password]);
|
||||
} else {
|
||||
$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
|
||||
$connection->executeUpdate($query);
|
||||
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
|
||||
$connection->executeUpdate($query);
|
||||
$query = "CREATE USER ?@'localhost' IDENTIFIED BY ?";
|
||||
$connection->executeUpdate($query, [$name,$password]);
|
||||
$query = "CREATE USER ?@'%' IDENTIFIED BY ?";
|
||||
$connection->executeUpdate($query, [$name,$password]);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->error('Database user creation failed.', [
|
||||
|
|
@ -119,7 +119,7 @@ class MySQL extends AbstractDatabase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $username
|
||||
* @param string $username
|
||||
* @param IDBConnection $connection
|
||||
*/
|
||||
private function createSpecificUser($username, $connection): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue