Skip to content

Commit b1a9a7a

Browse files
kazmiyasplitbrain
authored andcommitted
Fix stored XSS vulnerability via do=export_metadata dokuwiki#4305
This prevents metadata export in general and also ensures the the temporary $doc property in the metadata renderer is cleared in document_end
1 parent df992f9 commit b1a9a7a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

inc/Action/Export.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public function preProcess()
8686
$headers['Content-Type'] = 'text/html; charset=utf-8';
8787
$output = p_wiki_xhtml($ID, $REV, false);
8888
break;
89+
case 'metadata':
90+
// metadata should not be exported
91+
break;
8992
default:
9093
$output = p_cached_output(wikiFN($ID, $REV), $mode, $ID);
9194
$headers = p_get_metadata($ID, "format $mode");

inc/parser/metadata.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public function document_end()
108108
if (!isset($this->meta['date']['modified'])) {
109109
$this->meta['date']['modified'] = filemtime(wikiFN($ID));
110110
}
111+
112+
$this->doc = '';
111113
}
112114

113115
/**

0 commit comments

Comments
 (0)