Skip to content

Commit c2bee22

Browse files
committed
Mark parameter in ext/mysqli as sensitive
1 parent 4f0bb4a commit c2bee22

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

ext/mysqli/mysqli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "php_mysqli.h"
3030
#include "php_mysqli_structs.h"
3131
#include "mysqli_priv.h"
32+
#include "zend_attributes.h"
3233
#include "zend_exceptions.h"
3334
#include "ext/spl/spl_exceptions.h"
3435
#include "zend_interfaces.h"

ext/mysqli/mysqli.stub.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public function autocommit(bool $enable): bool {}
149149
public function begin_transaction(int $flags = 0, ?string $name = null): bool {}
150150

151151
/**
152+
* @sensitive-param $password
152153
* @tentative-return-type
153154
* @alias mysqli_change_user
154155
*/
@@ -174,6 +175,7 @@ public function close() {} // TODO make return type void
174175
public function commit(int $flags = 0, ?string $name = null): bool {}
175176

176177
/**
178+
* @sensitive-param $password
177179
* @tentative-return-type
178180
* @alias mysqli_connect
179181
* @no-verify
@@ -287,6 +289,7 @@ public function prepare(string $query): mysqli_stmt|false {}
287289
public function query(string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool {}
288290

289291
/**
292+
* @sensitive-param $password
290293
* @tentative-return-type
291294
* @alias mysqli_real_connect
292295
*/
@@ -740,6 +743,7 @@ function mysqli_autocommit(mysqli $mysql, bool $enable): bool {}
740743

741744
function mysqli_begin_transaction(mysqli $mysql, int $flags = 0, ?string $name = null): bool {}
742745

746+
/** @sensitive-param $password */
743747
function mysqli_change_user(mysqli $mysql, string $username, string $password, ?string $database): bool {}
744748

745749
/** @refcount 1 */
@@ -750,7 +754,10 @@ function mysqli_close(mysqli $mysql): bool {} // TODO make return type void
750754

751755
function mysqli_commit(mysqli $mysql, int $flags = 0, ?string $name = null): bool {}
752756

753-
/** @refcount 1 */
757+
/**
758+
* @refcount 1
759+
* @sensitive-param $password
760+
*/
754761
function mysqli_connect(
755762
?string $hostname = null,
756763
?string $username = null,
@@ -925,6 +932,7 @@ function mysqli_report(int $flags): bool {}
925932
/** @refcount 1 */
926933
function mysqli_query(mysqli $mysql, string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool {}
927934

935+
/** @sensitive-param $password */
928936
function mysqli_real_connect(
929937
mysqli $mysql,
930938
?string $hostname = null,

ext/mysqli/mysqli_arginfo.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 794efd97f6eac5e755bed2eb6219173a1ee45321 */
2+
* Stub hash: db2ec0349b8b40e9352569e08cb4a3bd253f0255 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
55
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
@@ -1027,7 +1027,13 @@ static const zend_function_entry class_mysqli_sql_exception_methods[] = {
10271027

10281028
static void register_mysqli_symbols(int module_number, zend_class_entry *class_entry_mysqli)
10291029
{
1030+
zend_mark_function_parameter_as_sensitive(CG(function_table), "mysqli_change_user", 2);
1031+
zend_mark_function_parameter_as_sensitive(CG(function_table), "mysqli_connect", 2);
1032+
zend_mark_function_parameter_as_sensitive(CG(function_table), "mysqli_real_connect", 3);
10301033
zend_mark_function_parameter_as_sensitive(&class_entry_mysqli->function_table, "__construct", 2);
1034+
zend_mark_function_parameter_as_sensitive(&class_entry_mysqli->function_table, "change_user", 1);
1035+
zend_mark_function_parameter_as_sensitive(&class_entry_mysqli->function_table, "connect", 2);
1036+
zend_mark_function_parameter_as_sensitive(&class_entry_mysqli->function_table, "real_connect", 2);
10311037
}
10321038

10331039
static zend_class_entry *register_class_mysqli_driver(void)

0 commit comments

Comments
 (0)