]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/xslt/discussion.mdwn
ikiwiki (3.20130711) unstable; urgency=low
[ikiwiki.git] / doc / plugins / contrib / xslt / discussion.mdwn
1 ## security
2
3 I'm curious what the security implications of having this plugin on a
4 publically writable wiki are.
5
6 First, it looks like the way it looks up the stylesheet file will happily
7 use a regular .mdwn wiki page as the stylsheet. Which means any user can
8 create a stylesheet and have it be used, without needing permission to
9 upload arbitrary files. That probably needs to be fixed; one way would be
10 to mandate that the `srcfile` has a `.xsl` extension.
11
12 Secondly, if an attacker is able to upload a stylesheet file somehow, could
13 this be used to attack the server where it is built? I know that xslt is
14 really a full programming language, so I assume at least DOS attacks are
15 possible. Can it also read other arbitrary files, run other programs, etc?
16 --[[Joey]] 
17
18 > For the first point, agreed.  It should probably check that the data file has a `.xml` extension also.  Have now fixed.
19
20 > For the second point, I think the main concern would be resource usage.  XSLT is a pretty limited language; it can read other XML files, but it can't run other programs so far as I know.
21
22 > -- [[KathrynAndersen]]
23
24 >> XSLT is, indeed, a Turing-complete programming language.
25    However, [XML::LibXSLT][] provides a set of functions to help
26    to minimize the damage that may be caused by running a random
27    program.
28
29 >> In particular, `max_depth ()` allows for the maximum
30    recursion depth to be set, while
31    `read_file ()`, `write_file ()`, `create_dir ()`,
32    `read_net ()` and `write_net ()`
33    are the callbacks that allow any of the possible file
34    operations to be denied.
35
36 >> To be honest, I'd prefer for the `read_file ()` callback to
37    only grant access to the files below the Ikiwiki source
38    directory, and for all the `write_`… and
39    …`_net` callbacks to deny the access unconditionally.
40
41 >> One more wishlist item: allow the set of locations to take
42    `.xsl` files from to be preconfigured, so that, e. g.,
43    one could allow (preasumably trusted) system stylesheets,
44    while disallowing any stylesheets that are placed on the Wiki
45    itself.
46
47 >> — Ivan Shmakov, 2010-03-28Z.
48
49 [XML::LibXSLT]: http://search.cpan.org/~PAJAS/XML-LibXSLT/LibXSLT.pm