Avoid XSS in pagination ordering
This commit is contained in:
parent
8cf8f9ef07
commit
83deec2e36
|
|
@ -169,10 +169,16 @@ class Paginator
|
||||||
public function executeQuery()
|
public function executeQuery()
|
||||||
{
|
{
|
||||||
if ($this->query !== null) {
|
if ($this->query !== null) {
|
||||||
|
|
||||||
$this->query
|
$this->query
|
||||||
->offset($this->offset)
|
->offset($this->offset)
|
||||||
->limit($this->limit)
|
->limit($this->limit);
|
||||||
->orderBy($this->order, $this->direction);
|
|
||||||
|
if (preg_match('/^[a-zA-Z0-9._]+$/', $this->order)) {
|
||||||
|
$this->query->orderBy($this->order, $this->direction);
|
||||||
|
} else {
|
||||||
|
$this->order = '';
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->formatter !== null) {
|
if ($this->formatter !== null) {
|
||||||
return $this->formatter->withQuery($this->query)->format();
|
return $this->formatter->withQuery($this->query)->format();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue