mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Merge pull request #6810 from orklah/castArrayTaints
Array cast pass taints
This commit is contained in:
commit
bf993452a8
@ -232,8 +232,7 @@ class CastAnalyzer
|
|||||||
$type = Type::getArray();
|
$type = Type::getArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($statements_analyzer->data_flow_graph instanceof \Psalm\Internal\Codebase\VariableUseGraph
|
if ($statements_analyzer->data_flow_graph) {
|
||||||
) {
|
|
||||||
$type->parent_nodes = $stmt_expr_type->parent_nodes ?? [];
|
$type->parent_nodes = $stmt_expr_type->parent_nodes ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2190,6 +2190,16 @@ class TaintTest extends TestCase
|
|||||||
'error_message' => 'TaintedHtml',
|
'error_message' => 'TaintedHtml',
|
||||||
],
|
],
|
||||||
*/
|
*/
|
||||||
|
'castToArrayPassTaints' => [
|
||||||
|
'<?php
|
||||||
|
$args = $_POST;
|
||||||
|
|
||||||
|
$args = (array) $args;
|
||||||
|
|
||||||
|
pg_query($connection, "SELECT * FROM tableA where key = " .$args["key"]);
|
||||||
|
',
|
||||||
|
'error_message' => 'TaintedSql',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user