Skip to content

Commit

Permalink
fix(php)(symfony): multiple parameters for SQLi sanitization method
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet committed May 17, 2024
1 parent eb18ecf commit d2954dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rules/php/symfony/sql_injection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ auxiliary:
scope: cursor
- id: php_symfony_sql_injection_input_sanitizer
patterns:
- pattern: $<_>->createNamedParameter($<!>$<_>)
- pattern: $<_>->quote($<!>$<_>)
- pattern: $<_>->setParameter($<!>$<_>)
- pattern: $<_>->createNamedParameter($<!>$<_>$<...>)
- pattern: $<_>->setParameter($<!>$<_>$<...>)
languages:
- php
severity: critical
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public function oops2(): array
$data = $query->getResult();
return $data;
}

public function okay(): array
{
$queryBuilder->where(
$queryBuilder->expr()->like('name', $queryBuilder->createNamedParameter($_GET['username'])
$queryBuilder->expr()->like('name', $this->queryBuilder->createNamedParameter($_GET['username'], Connection::PARAM_STR))
);
}
}

0 comments on commit d2954dc

Please sign in to comment.