Skip to content

Commit

Permalink
Merge fefb39a into 773b158
Browse files Browse the repository at this point in the history
  • Loading branch information
Sweepr committed Dec 20, 2020
2 parents 773b158 + fefb39a commit cf3fd5a
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion lib/dao/Base/Dao_Base_Spot.php
Expand Up @@ -29,8 +29,55 @@ public function getSpots($ourUserId, $pageNr, $limit, $parsedSearch)
* which are always available in the query
*/
$criteriaFilter = ' WHERE (bl.spotterid IS NULL) ';
if (!empty($parsedSearch['filter'])) {
if (!empty($parsedSearch['filter'])) {
$criteriaFilter .= ' AND '.$parsedSearch['filter'];

/* Blacklisted SQL commands */

$notAllowedCommands = array(
'DELETE',
'TRUNCATE',
'AS',
'DROP',
'USE',
'SELECT',
'SLEEP',
'UPDATE',
'ALTER',
'CREATE',
'RENAME',
'GRANT',
'REVOKE',
'BETWEEN',
'COMMIT',
'SAVEPOINT',
'EXISTS',
'GROUP',
'HAVING',
'IN',
'INTO',
'INSERT',
'ORDER',
'BY',
'UNION',
'LEFT',
'RIGHT',
'FULL'
);

/* Check $criteriaFilter for blacklisted SQL commands */

if(preg_match('[' . implode(' |', $notAllowedCommands ) . ']i', $criteriaFilter) == true) {

echo '<script language="javascript">';
echo 'alert("This query is not allowed!")';
echo '</script>';
echo '<script language = "javascript">';
echo 'window.location.href = "/?search[tree]=&search[unfiltered]=true"';
echo '</script>';
exit();

}
} // if

/*
Expand Down

0 comments on commit cf3fd5a

Please sign in to comment.