Skip to content

Commit

Permalink
Remove the possibility of a CSRF attack unlocking a page / module entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
timbuckingham committed May 25, 2017
1 parent b722939 commit c17d09b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/admin/auto-modules/forms/_locked.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</p>
</section>
<footer>
<a href="?force=true<?=$view_data?>" class="button blue">Unlock</a>
<a href="?force=true<?=$view_data?><? $admin->drawCSRFTokenGET(); ?>" class="button blue">Unlock</a>
&nbsp;
<a href="javascript:history.go(-1);" class="button white">Cancel</a>
</footer>
Expand Down
8 changes: 7 additions & 1 deletion core/admin/auto-modules/forms/edit.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?
// Check for a page lock
$force = isset($_GET["force"]) ? true : false;
if (!empty($_GET["force"])) {
$admin->verifyCSRFToken();
$force = true;
} else {
$force = false;
}

$admin->lockCheck($bigtree["form"]["table"],$bigtree["edit_id"],"admin/auto-modules/forms/_locked.php",$force);

$pending_entry = BigTreeAutoModule::getPendingItem($bigtree["form"]["table"],$bigtree["edit_id"]);
Expand Down
2 changes: 1 addition & 1 deletion core/admin/modules/pages/_locked.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<footer>
<a href="javascript:history.go(-1);" class="button white">Cancel</a>
&nbsp;
<a href="?force=true" class="button blue">Unlock</a>
<a href="?force=true<? $admin->drawCSRFTokenGET() ?>" class="button blue">Unlock</a>
</footer>
</div>
8 changes: 7 additions & 1 deletion core/admin/modules/pages/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
include BigTree::path("admin/modules/pages/_properties.php");

// Check for a page lock
$force = isset($_GET["force"]) ? $_GET["force"] : false;
if (!empty($_GET["force"])) {
$admin->verifyCSRFToken();
$force = true;
} else {
$force = false;
}

$admin->lockCheck("bigtree_pages",$page["id"],"admin/modules/pages/_locked.php",$force);

// Grab template information
Expand Down
8 changes: 7 additions & 1 deletion core/admin/modules/pages/revisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
}

// Check for a page lock
$force = isset($_GET["force"]) ? $_GET["force"] : false;
if (!empty($_GET["force"])) {
$admin->verifyCSRFToken();
$force = true;
} else {
$force = false;
}

$lock_id = $admin->lockCheck("bigtree_pages",$page["id"],"admin/modules/pages/_locked.php",$force);

// See if there's a draft copy.
Expand Down

0 comments on commit c17d09b

Please sign in to comment.