2008-07-02 22:14:18 +02:00
|
|
|
<TMPL_VAR JAVASCRIPT>
|
2008-07-23 01:58:34 +02:00
|
|
|
<TMPL_VAR MESSAGE>
|
2010-06-13 14:47:21 +02:00
|
|
|
<br />
|
2006-03-12 17:37:26 +01:00
|
|
|
<TMPL_VAR FORM-START>
|
|
|
|
<TMPL_VAR FIELD-DO>
|
Fix CSRF attacks against the preferences and edit forms. Closes: #475445
The fix involved embedding the session id in the forms, and not allowing the
forms to be submitted if the embedded id does not match the session id.
In the case of the preferences form, if the session id is not embedded,
then the CGI parameters are cleared. This avoids a secondary attack where the
link to the preferences form prefills password or other fields, and
the user hits "submit" without noticing these prefilled values.
In the case of the editpage form, the anonok plugin can allow anyone to edit,
and so I chose not to guard against CSRF attacks against users who are not
logged in. Otherwise, it also embeds the session id and checks it.
For page editing, I assume that the user will notice if content or commit
message is changed because of CGI parameters, and won't blndly hit save page.
So I didn't block those CGI paramters. (It's even possible to use those CGI
parameters, for good, not for evil, I guess..)
The only other CSRF attack I can think of in ikiwiki involves the poll plugin.
It's certianly possible to set up a link that causes the user to unknowingly
vote in a poll. However, the poll plugin is not intended to be used for things
that people would want to attack, since anyone can after all edit the poll page
and fill in any values they like. So this "attack" is ignorable.
2008-04-10 22:35:30 +02:00
|
|
|
<TMPL_VAR FIELD-SID>
|
2006-03-12 17:37:26 +01:00
|
|
|
<TMPL_VAR FIELD-FROM>
|
2006-03-19 21:34:59 +01:00
|
|
|
<TMPL_VAR FIELD-RCSINFO>
|
2007-02-24 01:39:06 +01:00
|
|
|
<TMPL_VAR FIELD-NEWFILE>
|
2010-05-07 03:45:17 +02:00
|
|
|
<TMPL_IF NAME="PAGE_SELECT">
|
|
|
|
<label for="page" class="inline">Page location:</label><TMPL_VAR FIELD-PAGE>
|
|
|
|
<label for="type" class="inline">Page type:</label><TMPL_VAR FIELD-TYPE>
|
2006-03-12 17:37:26 +01:00
|
|
|
<TMPL_ELSE>
|
|
|
|
<TMPL_VAR FIELD-PAGE>
|
2006-07-26 23:23:06 +02:00
|
|
|
<TMPL_VAR FIELD-TYPE>
|
2006-03-12 17:37:26 +01:00
|
|
|
</TMPL_IF>
|
2010-06-10 20:14:46 +02:00
|
|
|
<div class="editcontentdiv">
|
2006-05-27 21:04:46 +02:00
|
|
|
<TMPL_VAR FIELD-EDITCONTENT><br />
|
2010-06-10 20:14:46 +02:00
|
|
|
</div>
|
2010-05-07 03:45:17 +02:00
|
|
|
<TMPL_IF NAME="CAN_COMMIT">
|
2010-06-13 00:10:33 +02:00
|
|
|
<label for="editmessage" class="block">Optional comment about this change:</label>
|
|
|
|
<TMPL_VAR FIELD-EDITMESSAGE><br />
|
2006-03-12 17:37:26 +01:00
|
|
|
</TMPL_IF>
|
2007-08-17 07:34:59 +02:00
|
|
|
<TMPL_VAR FORM-SUBMIT>
|
2006-07-02 19:44:43 +02:00
|
|
|
<TMPL_VAR HELPONFORMATTINGLINK>
|
2010-05-07 03:45:17 +02:00
|
|
|
<TMPL_IF NAME="FIELD-ATTACHMENT">
|
2008-07-21 18:15:55 +02:00
|
|
|
<a class="toggle" href="#attachments">Attachments</a>
|
2011-06-15 21:21:59 +02:00
|
|
|
<div class="<TMPL_VAR ATTACHMENTS-CLASS>" id="attachments">
|
|
|
|
<div id="fileupload">
|
2011-06-16 00:37:12 +02:00
|
|
|
<script>
|
|
|
|
$(function () { $('#fileupload').fileupload(); }); // initialize upload widget
|
|
|
|
</script>
|
2011-06-15 21:21:59 +02:00
|
|
|
<script id="template-upload" type="text/x-jquery-tmpl">
|
|
|
|
<tr class="template-upload{{if error}} ui-state-error{{/if}}">
|
2011-06-16 00:37:12 +02:00
|
|
|
<td><input type="checkbox" name="attachment_select" value="${name}" />${name}</td>
|
2011-06-15 21:21:59 +02:00
|
|
|
{{if error}}
|
2011-06-16 00:37:12 +02:00
|
|
|
<td class="error" colspan="2">failed!</td>
|
2011-06-15 21:21:59 +02:00
|
|
|
{{else}}
|
2011-06-16 00:37:12 +02:00
|
|
|
<td class="progress" colspan="2"><div></div></td>
|
|
|
|
<td class="start"><button>Start</button></td>
|
2011-06-15 21:21:59 +02:00
|
|
|
{{/if}}
|
|
|
|
<td class="cancel"><button>Cancel</button></td>
|
|
|
|
</tr>
|
|
|
|
</script>
|
|
|
|
<script id="template-download" type="text/x-jquery-tmpl">
|
|
|
|
<tr class="template-download{{if error}} ui-state-error{{/if}}">
|
|
|
|
<td><input type="checkbox" name="attachment_select" value="${name}" />${name}</td>
|
|
|
|
<td>${humansize}</td>
|
|
|
|
{{if error}}
|
2011-06-16 00:37:12 +02:00
|
|
|
<td class="error" colspan="2">failed!</td>
|
2011-06-15 21:21:59 +02:00
|
|
|
{{else}}
|
2011-06-16 00:37:12 +02:00
|
|
|
<td>${stored_msg}</td>
|
2011-06-15 21:21:59 +02:00
|
|
|
{{/if}}
|
|
|
|
</tr>
|
|
|
|
</script>
|
|
|
|
<div class="fileupload-content">
|
|
|
|
<table class="files">
|
|
|
|
<TMPL_LOOP NAME="ATTACHMENT_LIST">
|
|
|
|
<tr><td><input type="checkbox" name="attachment_select" value="<TMPL_VAR NAME ESCAPE="HTML">" /><TMPL_VAR LINK></td><td><TMPL_VAR SIZE></td><td><TMPL_VAR MTIME></td></tr>
|
|
|
|
</TMPL_LOOP>
|
2008-07-01 23:19:38 +02:00
|
|
|
</table>
|
|
|
|
</div>
|
2011-06-16 00:37:12 +02:00
|
|
|
<TMPL_VAR FIELD-ATTACHMENT>
|
|
|
|
<noscript><TMPL_VAR FIELD-UPLOAD></noscript>
|
|
|
|
<TMPL_IF NAME="ATTACHMENT_LIST">
|
|
|
|
<TMPL_VAR FIELD-LINK><TMPL_VAR FIELD-RENAME><TMPL_VAR FIELD-REMOVE>
|
|
|
|
</TMPL_IF>
|
2011-06-15 21:21:59 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2008-07-01 03:15:19 +02:00
|
|
|
</TMPL_IF>
|
2006-03-12 17:37:26 +01:00
|
|
|
<TMPL_VAR FORM-END>
|
2009-03-08 00:52:14 +01:00
|
|
|
<TMPL_VAR WMD_PREVIEW>
|
2010-05-07 03:45:17 +02:00
|
|
|
<TMPL_IF NAME="PAGE_PREVIEW">
|
2006-07-02 19:44:43 +02:00
|
|
|
<hr />
|
2006-05-26 03:42:00 +02:00
|
|
|
<div class="header">
|
2006-05-26 03:10:58 +02:00
|
|
|
<span>Page preview:</span>
|
2006-03-29 09:24:03 +02:00
|
|
|
</div>
|
2007-07-16 07:24:31 +02:00
|
|
|
<div id="preview">
|
2006-03-16 22:39:45 +01:00
|
|
|
<TMPL_VAR PAGE_PREVIEW>
|
2006-03-29 09:24:03 +02:00
|
|
|
</div>
|
2006-03-16 22:39:45 +01:00
|
|
|
</TMPL_IF>
|
2010-05-07 04:19:14 +02:00
|
|
|
<TMPL_IF NAME="PAGE_DIFF">
|
|
|
|
<hr />
|
|
|
|
<div class="header">
|
|
|
|
<span>Diff:</span>
|
|
|
|
</div>
|
|
|
|
<div id="diff">
|
|
|
|
<TMPL_VAR PAGE_DIFF>
|
|
|
|
</div>
|
|
|
|
</TMPL_IF>
|