Skip to content

Commit

Permalink
Preventing CSRF in /file_manager/fm_api.php
Browse files Browse the repository at this point in the history
  • Loading branch information
myvesta committed Aug 28, 2021
1 parent 9277b37 commit 0336e8b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions web/file_manager/fm_api.php
Expand Up @@ -3,15 +3,7 @@
//error_reporting(NULL);

// Preventing CSRF
if ($_SERVER['REQUEST_METHOD']=='POST') {
$host_arr=explode(":", $_SERVER['HTTP_HOST']);
$hostname=$host_arr[0];
$port = $_SERVER['SERVER_PORT'];
$expected_http_origin="https://".$hostname.":".$port;
if ($_SERVER['HTTP_ORIGIN'] != $expected_http_origin) {
die ("Nope.");
}
}
prevent_post_csrf(true);

header('Content-Type: application/json');

Expand Down

0 comments on commit 0336e8b

Please sign in to comment.