Skip to content

Commit

Permalink
Security fix for SQL Injection vulnerability
Browse files Browse the repository at this point in the history
Thanks to https://snyk.io/ for finding the bug.
  • Loading branch information
usmanhalalit committed Nov 16, 2019
1 parent d35ae8f commit 9bd9910
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The syntax is quite similar to Laravel's query builder.
require 'vendor/autoload.php';

// Create a connection, once only.
$config = array(
$config = [
'driver' => 'mysql', // Db driver
'host' => 'localhost',
'database' => 'your-database',
Expand All @@ -29,11 +29,11 @@ $config = array(
'charset' => 'utf8', // Optional
'collation' => 'utf8_unicode_ci', // Optional
'prefix' => 'cb_', // Table prefix, optional
'options' => array( // PDO constructor options, optional
'options' => [ // PDO constructor options, optional
PDO::ATTR_TIMEOUT => 5,
PDO::ATTR_EMULATE_PREPARES => false,
),
);
],
];

new \Pixie\Connection('mysql', $config, 'QB');
```
Expand Down Expand Up @@ -659,4 +659,4 @@ Here are some cases where Query Events can be extremely helpful:
___
If you find any typo then please edit and send a pull request.

© 2016 [Muhammad Usman](http://usman.it/). Licensed under MIT license.
© 2020 [Muhammad Usman](http://usman.it/). Licensed under MIT license.
4 changes: 2 additions & 2 deletions src/Pixie/QueryBuilder/Adapters/BaseAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function select($statements)
}

// Limit and offset
$limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : '';
$offset = isset($statements['offset']) ? 'OFFSET ' . $statements['offset'] : '';
$limit = isset($statements['limit']) ? 'LIMIT ' . (int) $statements['limit'] : '';
$offset = isset($statements['offset']) ? 'OFFSET ' . (int) $statements['offset'] : '';

// Having
list($havingCriteria, $havingBindings) = $this->buildCriteriaWithType($statements, 'havings', 'HAVING');
Expand Down

0 comments on commit 9bd9910

Please sign in to comment.