-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CSRF validation for sorting in property tables
- Loading branch information
Showing
3 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Director\Web\Form; | ||
|
||
use Icinga\Web\Session; | ||
use ipl\Html\Form; | ||
use ipl\Html\ValidHtml; | ||
use ipl\Web\Common\CsrfCounterMeasure; | ||
|
||
class PropertyTableSortForm extends Form | ||
{ | ||
use CsrfCounterMeasure; | ||
|
||
protected $method = 'POST'; | ||
|
||
/** @var string Name of the form */ | ||
private $name; | ||
|
||
/** @var ValidHtml Property table to sort */ | ||
private $table; | ||
|
||
public function __construct(string $name, ValidHtml $table) | ||
{ | ||
$this->name = $name; | ||
$this->table = $table; | ||
} | ||
|
||
protected function assemble() | ||
{ | ||
$this->addElement('hidden', '__FORM_NAME', ['value' => $this->name]); | ||
$this->addElement($this->createCsrfCounterMeasure(Session::getSession()->getId())); | ||
$this->addHtml($this->table); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters