Skip to content

Commit 6e642d5

Browse files
authored
Merge pull request #248 from koriym/add-psalm-taint-annotations
Add Psalm taint analysis annotations for SQL injection detection
2 parents 8bfede0 + c3ce56b commit 6e642d5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/ExtendedPdoInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ public function getProfiler(): ProfilerInterface;
251251
*
252252
* @return string The multi-part identifier name, quoted.
253253
*
254+
* @psalm-taint-escape sql
254255
*/
255256
public function quoteName(string $name): string;
256257

@@ -262,6 +263,7 @@ public function quoteName(string $name): string;
262263
*
263264
* @return string The quoted identifier name.
264265
*
266+
* @psalm-taint-escape sql
265267
*/
266268
public function quoteSingleName(string $name): string;
267269

src/PdoInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function errorInfo(): array;
9292
*
9393
* @see http://php.net/manual/en/pdo.exec.php
9494
*
95+
* @psalm-taint-sink sql $statement
9596
*/
9697
public function exec(string $statement): int|false;
9798

@@ -152,6 +153,8 @@ public function lastInsertId(?string $name = null): string|false;
152153
* @return \PDOStatement|false
153154
*
154155
* @see http://php.net/manual/en/pdo.prepare.php
156+
*
157+
* @psalm-taint-sink sql $query
155158
*/
156159
public function prepare(string $query, array $options = []): PDOStatement|false;
157160

@@ -169,6 +172,7 @@ public function prepare(string $query, array $options = []): PDOStatement|false;
169172
*
170173
* @see http://php.net/manual/en/pdo.query.php
171174
*
175+
* @psalm-taint-sink sql $query
172176
*/
173177
public function query(string $query, ?int $fetchMode = null, ...$fetch_mode_args): PDOStatement|false;
174178

@@ -184,6 +188,7 @@ public function query(string $query, ?int $fetchMode = null, ...$fetch_mode_args
184188
*
185189
* @see http://php.net/manual/en/pdo.quote.php
186190
*
191+
* @psalm-taint-escape sql
187192
*/
188193
public function quote(string|int|array|float|null $value, int $type = PDO::PARAM_STR): string|false;
189194

0 commit comments

Comments
 (0)