Skip to content

Commit

Permalink
docs: simplify TaintBadDataPlugin example again
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick-Remy committed Jan 23, 2024
1 parent 8a05e31 commit bb10f13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/security_analysis/custom_taint_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class TaintBadDataPlugin implements AddTaintsInterface
{
$expr = $event->getExpr();

if (!$expr instanceof Variable) {
return [];
if ($expr instanceof Variable && $expr->name === 'bad_data') {
return TaintKindGroup::ALL_INPUT;
}

return $expr->name === 'bad_data' ? TaintKindGroup::ALL_INPUT : [];
return [];
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public static function addTaints(AddRemoveTaintsEvent $event): array
{
$expr = $event->getExpr();

if (!$expr instanceof Variable) {
return [];
if ($expr instanceof Variable && $expr->name === 'bad_data') {
return TaintKindGroup::ALL_INPUT;
}

return $expr->name === 'bad_data' ? TaintKindGroup::ALL_INPUT : [];
return [];
}
}

0 comments on commit bb10f13

Please sign in to comment.