mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
CSRF Token
Upon login, issue the user a CSRF token (in their session). This token should be provided when completing sensitive actions (e.g. deleting companies/clients, changing their password, etc.) Ref: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern
This commit is contained in:
20
post.php
20
post.php
@@ -58,6 +58,9 @@ if(isset($_POST['add_user'])){
|
||||
exit();
|
||||
}
|
||||
|
||||
// CSRF Check
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$email = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])));
|
||||
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
||||
@@ -140,6 +143,9 @@ if(isset($_POST['edit_user'])){
|
||||
exit();
|
||||
}
|
||||
|
||||
// CSRF Check
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
|
||||
$user_id = intval($_POST['user_id']);
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$email = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])));
|
||||
@@ -238,6 +244,9 @@ if(isset($_POST['edit_profile'])){
|
||||
exit();
|
||||
}
|
||||
|
||||
// CSRF Check
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
|
||||
$user_id = intval($_POST['user_id']);
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$email = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])));
|
||||
@@ -375,6 +384,9 @@ if(isset($_GET['archive_user'])){
|
||||
exit();
|
||||
}
|
||||
|
||||
// CSRF Check
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
// Variables from GET
|
||||
$user_id = intval($_GET['archive_user']);
|
||||
$password = password_hash(key32gen(), PASSWORD_DEFAULT);
|
||||
@@ -695,6 +707,9 @@ if(isset($_GET['delete_company'])){
|
||||
exit();
|
||||
}
|
||||
|
||||
// CSRF Check
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
$company_id = intval($_GET['delete_company']);
|
||||
|
||||
//Get Company Name
|
||||
@@ -760,7 +775,7 @@ if(isset($_GET['delete_company'])){
|
||||
$_SESSION['alert_type'] = "danger";
|
||||
$_SESSION['alert_message'] = "Company <strong>$company_name</strong> deleted";
|
||||
|
||||
header("Location: logout.php");
|
||||
header("Location: post.php?logout");
|
||||
|
||||
}
|
||||
|
||||
@@ -1456,6 +1471,9 @@ if(isset($_GET['delete_client'])){
|
||||
exit();
|
||||
}
|
||||
|
||||
// CSRF Check
|
||||
validateCSRFToken($_GET['csrf_token']);
|
||||
|
||||
$client_id = intval($_GET['delete_client']);
|
||||
|
||||
//Get Client Name
|
||||
|
||||
Reference in New Issue
Block a user