Skip to content

Commit

Permalink
Deactivate XSS-Protection during preview
Browse files Browse the repository at this point in the history
The motivation is to work around/fix issue #1182.

Using a CSP-Header did not work.

ToDo:
- [ ] Implement a check for Chrome only.
  • Loading branch information
micgro42 committed Oct 29, 2015
1 parent 07194c6 commit 844aec6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions inc/actions.php
Expand Up @@ -29,6 +29,8 @@ function act_dispatch(){

// give plugins an opportunity to process the action
$evt = new Doku_Event('ACTION_ACT_PREPROCESS',$ACT);

$headers = array();
if ($evt->advise_before()) {

//sanitize $ACT
Expand Down Expand Up @@ -144,8 +146,10 @@ function act_dispatch(){
$ACT = act_draftdel($ACT);

//draft saving on preview
if($ACT == 'preview')
if($ACT == 'preview') {
$headers[] = "X-XSS-Protection: 0";
$ACT = act_draftsave($ACT);
}

//edit
if(in_array($ACT, array('edit', 'preview', 'recover'))) {
Expand Down Expand Up @@ -189,7 +193,6 @@ function act_dispatch(){
global $license;

//call template FIXME: all needed vars available?
$headers = array();
$headers[] = 'Content-Type: text/html; charset=utf-8';
trigger_event('ACTION_HEADERS_SEND',$headers,'act_sendheaders');

Expand Down

0 comments on commit 844aec6

Please sign in to comment.