Skip to content

Commit

Permalink
Replace TaintAnalysis test by .phpt
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed Mar 17, 2024
1 parent 1450620 commit 220ca96
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 47 deletions.
47 changes: 0 additions & 47 deletions tests/Acceptance/acceptance/TaintAnalysis.feature

This file was deleted.

13 changes: 13 additions & 0 deletions tests/Type/tests/TaintAnalysis/TaintedHtml.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--ARGS--
--no-progress --no-diff --config=./tests/Type/psalm.xml --taint-analysis
--FILE--
<?php declare(strict_types=1);

function test_db_raw(\Illuminate\Http\Request $request) {
$taint_input = $request->input('foo');

return new \Illuminate\Http\Response($taint_input);
}
?>
--EXPECTF--
TaintedHtml on line %d: Detected tainted HTML
14 changes: 14 additions & 0 deletions tests/Type/tests/TaintAnalysis/TaintedSql.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--ARGS--
--no-progress --no-diff --config=./tests/Type/psalm.xml --taint-analysis
--FILE--
<?php declare(strict_types=1);

function test_db_raw(\Illuminate\Http\Request $request) {
$query_builder = new \Illuminate\Database\Query\Builder();
$user_input = $request->input('foo');

$query_builder->raw($user_input);
}
?>
--EXPECTF--
TaintedSql on line %d: Detected tainted SQL

0 comments on commit 220ca96

Please sign in to comment.