From 66b23ce9f134c838f393fa452c450f8b6fc147c3 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 29 Sep 2009 20:28:32 +0200 Subject: [PATCH] Send export_raw as attachement to avoid IE's content sniffing [security] Ignore-this: 9b6ef0179df729d4bc41c2d746965134 With MSIE's content-sniffing [1], the export_raw mode could be used for XSS attacks against MSIE users. Sending the export as a download circumvents that. [1] http://www.splitbrain.org/blog/2007-02/12-internet_explorer_facilitates_cross_site_scripting darcs-hash:20090929182832-7ad00-085deb3fa8cc939b55cd293a8f4780b4b170d2e6.gz --- inc/actions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/actions.php b/inc/actions.php index d61781629..4ade9aab2 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -462,7 +462,7 @@ function act_edit($act){ * Export a wiki page for various formats * * Triggers ACTION_EXPORT_POSTPROCESS - * + * * Event data: * data['id'] -- page id * data['mode'] -- requested export mode @@ -490,6 +490,7 @@ function act_export($act){ switch($mode) { case 'raw': $headers['Content-Type'] = 'text/plain; charset=utf-8'; + $headers['Content-Disposition'] = 'attachment; filename='.noNS($ID).'.txt'; $output = rawWiki($ID,$REV); break; case 'xhtml': -- 2.11.4.GIT