Skip to content

Commit

Permalink
no x-frame-options header set which allow clickjacking attack. Fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
notrinos committed Aug 23, 2022
1 parent e61e76b commit c2ff3d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions access/login.php
Expand Up @@ -52,6 +52,9 @@ function defaultCompany() {
$rtl = isset($_SESSION['language']->dir) ? $_SESSION['language']->dir : 'ltr';
$onload = !$login_timeout ? "onload='defaultCompany()'" : '';

if (!headers_sent())
header("X-Frame-Options: SAMEORIGIN");

echo "<!DOCTYPE html>\n";
echo "<html dir='".$rtl."' >\n";
echo "<head profile=\"http://www.w3.org/2005/10/profile\"><title>".$title."</title>\n";
Expand Down
3 changes: 3 additions & 0 deletions access/password_reset.php
Expand Up @@ -32,6 +32,9 @@ function defaultCompany() {
$rtl = isset($_SESSION['language']->dir) ? $_SESSION['language']->dir : 'ltr';
$onload = !$login_timeout ? "onload='defaultCompany()'" : '';

if (!headers_sent())
header("X-Frame-Options: SAMEORIGIN");

echo "<!DOCTYPE html>\n";
echo "<html dir='".$rtl."' >\n";
echo "<head profile=\"http://www.w3.org/2005/10/profile\"><title>".$title."</title>\n";
Expand Down
8 changes: 5 additions & 3 deletions includes/page/header.inc
Expand Up @@ -41,7 +41,7 @@ function help_url($context=null) {
.'&ctxhelp=1&lang='.$country);
}

function send_css($css = '') {
function send_css($css='') {
global $css_files;

init_css();
Expand Down Expand Up @@ -119,8 +119,10 @@ function page_header($title, $no_menu=false, $is_index=false, $onload='', $js=''

$encoding = $_SESSION['language']->encoding;

if (!headers_sent())
if (!headers_sent()) {
header("Content-type: text/html; charset=$encoding");
header("X-Frame-Options: SAMEORIGIN");
}

echo "<!DOCTYPE html>\n";
echo "<html dir='" . $_SESSION['language']->dir . "' >\n";
Expand All @@ -145,4 +147,4 @@ function page_header($title, $no_menu=false, $is_index=false, $onload='', $js=''
$rend = new renderer();
$rend->menu_header($title, $no_menu, $is_index);
error_box();
}
}

0 comments on commit c2ff3d8

Please sign in to comment.