Skip to content

Commit 9bd9910

Browse files
committed
Security fix for SQL Injection vulnerability
Thanks to https://snyk.io/ for finding the bug.
1 parent d35ae8f commit 9bd9910

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The syntax is quite similar to Laravel's query builder.
2020
require 'vendor/autoload.php';
2121

2222
// Create a connection, once only.
23-
$config = array(
23+
$config = [
2424
'driver' => 'mysql', // Db driver
2525
'host' => 'localhost',
2626
'database' => 'your-database',
@@ -29,11 +29,11 @@ $config = array(
2929
'charset' => 'utf8', // Optional
3030
'collation' => 'utf8_unicode_ci', // Optional
3131
'prefix' => 'cb_', // Table prefix, optional
32-
'options' => array( // PDO constructor options, optional
32+
'options' => [ // PDO constructor options, optional
3333
PDO::ATTR_TIMEOUT => 5,
3434
PDO::ATTR_EMULATE_PREPARES => false,
35-
),
36-
);
35+
],
36+
];
3737

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

662-
© 2016 [Muhammad Usman](http://usman.it/). Licensed under MIT license.
662+
© 2020 [Muhammad Usman](http://usman.it/). Licensed under MIT license.

src/Pixie/QueryBuilder/Adapters/BaseAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public function select($statements)
6565
}
6666

6767
// Limit and offset
68-
$limit = isset($statements['limit']) ? 'LIMIT ' . $statements['limit'] : '';
69-
$offset = isset($statements['offset']) ? 'OFFSET ' . $statements['offset'] : '';
68+
$limit = isset($statements['limit']) ? 'LIMIT ' . (int) $statements['limit'] : '';
69+
$offset = isset($statements['offset']) ? 'OFFSET ' . (int) $statements['offset'] : '';
7070

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

0 commit comments

Comments
 (0)