Skip to content

Commit 1fe4979

Browse files
authored
Merge pull request #42 from ThomasBrierley/specify-non-embeddable-pages
Specify non-embeddable pages
2 parents 29b642e + 2ebe2be commit 1fe4979

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/setup.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ function print_stack_trace() {
7070
ini_set('session.use_trans_sid',1);
7171
}
7272

73+
// Check for non-embeddable pages and declare appropriate CSP
74+
if ( preg_match('/(\/admin\/|\/login)/i', $_SERVER['REQUEST_URI']) ) {
75+
header("Content-Security-Policy: frame-ancestors 'self';");
76+
}
77+
7378
if ( ! isset($CFG->staticroot) ) die_with_error_log('$CFG->staticroot not defined in config.php');
7479
if ( ! isset($CFG->timezone) ) die_with_error_log('$CFG->timezone not defined in config.php');
7580
if ( strpos($CFG->dbprefix, ' ') !== false ) die_with_error_log('$CFG->dbprefix cannot have spaces in it');

0 commit comments

Comments
 (0)