Skip to content

Commit

Permalink
Improve application security
Browse files Browse the repository at this point in the history
- Make session cookies only available via HTTP (prevent access from JavaScript)
- only log PHP errors instead of displaying them in production.
  Displaying errors may give attackers hints how to exploit the application

Set HTTP headers:

X-Frame-Options: DENY
Prevent Clickjacking attacks, see: http://en.wikipedia.org/wiki/Clickjacking

X-Content-Type-Options: nosniff
Prevent code injection via mime type sniffing
  • Loading branch information
fhemberger committed Jan 21, 2014
1 parent 58c58c0 commit 4ca9258
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Core/Frameworks/Baikal/WWWRoot/cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

ini_set("session.cookie_httponly", 1);
ini_set("display_errors", 0);
ini_set("log_errors", 1);

define("BAIKAL_CONTEXT", TRUE);
define("PROJECT_CONTEXT_BASEURI", "/");

Expand Down
5 changes: 5 additions & 0 deletions Core/Frameworks/Baikal/WWWRoot/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

ini_set("session.cookie_httponly", 1);
ini_set("display_errors", 0);
ini_set("log_errors", 1);

define("BAIKAL_CONTEXT", TRUE);
define("PROJECT_CONTEXT_BASEURI", "/");

Expand Down
4 changes: 3 additions & 1 deletion Core/Frameworks/BaikalAdmin/WWWRoot/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

ini_set("display_errors", 1);
ini_set("session.cookie_httponly", 1);
ini_set("display_errors", 0);
ini_set("log_errors", 1);
error_reporting(E_ALL);

define("BAIKAL_CONTEXT", TRUE);
Expand Down
4 changes: 3 additions & 1 deletion Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

ini_set("display_errors", 1);
ini_set("session.cookie_httponly", 1);
ini_set("display_errors", 0);
ini_set("log_errors", 1);
error_reporting(E_ALL);

define("BAIKAL_CONTEXT", TRUE);
Expand Down
3 changes: 3 additions & 0 deletions Core/Frameworks/Flake/Controller/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public function getBaseUrl() {

public function injectHTTPHeaders() {
header("Content-Type: text/html; charset=UTF-8");

header("X-Frame-Options: DENY"); # Prevent Clickjacking attacks
header("X-Content-Type-Options: nosniff"); # Prevent code injection via mime type sniffing
}

public function render() {
Expand Down

0 comments on commit 4ca9258

Please sign in to comment.