mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
fix possible csrf attack due to missing form token
This commit is contained in:
parent
b2182362d3
commit
3fa952c5cb
|
@ -32,6 +32,11 @@ include("../inc/inc.Authentication.php");
|
|||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
|
||||
/* Check if the form data comes from a trusted request */
|
||||
if(!checkFormKey('editdocument')) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_request_token"))),getMLText("invalid_request_token"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
|
|
@ -32,6 +32,11 @@ include("../inc/inc.Authentication.php");
|
|||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
|
||||
/* Check if the form data comes from a trusted request */
|
||||
if(!checkFormKey('editfolder')) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_request_token"))),getMLText("invalid_request_token"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["folderid"]) || !is_numeric($_POST["folderid"]) || intval($_POST["folderid"])<1) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ $(document).ready( function() {
|
|||
$expdate = '';
|
||||
?>
|
||||
<form class="form-horizontal" action="../op/op.EditDocument.php" name="form1" id="form1" method="post">
|
||||
<?php echo createHiddenFieldWithKey('editdocument'); ?>
|
||||
<input type="hidden" name="documentid" value="<?php echo $document->getID() ?>">
|
||||
<?php
|
||||
$this->formField(
|
||||
|
|
|
@ -81,6 +81,7 @@ $(document).ready(function() {
|
|||
$this->contentContainerStart();
|
||||
?>
|
||||
<form class="form-horizontal" action="../op/op.EditFolder.php" id="form1" name="form1" method="post">
|
||||
<?php echo createHiddenFieldWithKey('editfolder'); ?>
|
||||
<input type="hidden" name="folderid" value="<?php print $folder->getID();?>">
|
||||
<input type="hidden" name="showtree" value="<?php echo showtree();?>">
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue
Block a user