]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/Symlinked_srcdir_requires_trailing_slash.mdwn
close
[ikiwiki.git] / doc / bugs / Symlinked_srcdir_requires_trailing_slash.mdwn
1 If the srcdir is a symlink, Ikiwiki will not render the pages unless the srcdir has a trailing slash.
2
3 For example:
4
5     #!/bin/sh
6     set -x
7
8     REALSRCDIR=~/tmp/ikiwiki/wikiwc2
9     SRCDIR=~/tmp/ikiwiki/wikiwc
10     DESTDIR=~/tmp/ikiwiki/public_html/wiki/
11
12     echo "*** Testing without trailing slash."
13
14     rm -rf $REALSRCDIR $SRCDIR $DESTDIR
15
16     # Create the real srcdir and link the srcdir to it
17     mkdir -p $REALSRCDIR
18     ln -s $REALSRCDIR $SRCDIR
19
20     mkdir -p $DESTDIR
21
22     echo Test > $SRCDIR/index.mdwn
23
24     # No trailing slash after $SRCDIR
25     ikiwiki --verbose $SRCDIR $DESTDIR --url=http://example.org/~you/wiki/ --underlaydir /dev/null
26
27     echo "*** Testing with trailing slash."
28
29     rm -rf $REALSRCDIR $SRCDIR $DESTDIR
30
31     # Create the real srcdir and link the srcdir to it
32     mkdir -p $REALSRCDIR
33     ln -s $REALSRCDIR $SRCDIR
34
35     mkdir -p $DESTDIR
36
37     echo Test > $SRCDIR/index.mdwn
38
39     # Trailing slash after $SRCDIR
40     ikiwiki --verbose $SRCDIR/ $DESTDIR --url=http://example.org/~you/wiki/ --underlaydir /dev/null
41
42 My output:
43
44     + REALSRCDIR=/home/svend/tmp/ikiwiki/wikiwc2
45     + SRCDIR=/home/svend/tmp/ikiwiki/wikiwc
46     + DESTDIR=/home/svend/tmp/ikiwiki/public_html/wiki/
47     + echo '*** Testing without trailing slash.'
48     *** Testing without trailing slash.
49     + rm -rf /home/svend/tmp/ikiwiki/wikiwc2 /home/svend/tmp/ikiwiki/wikiwc /home/svend/tmp/ikiwiki/public_html/wiki/
50     + mkdir -p /home/svend/tmp/ikiwiki/wikiwc2
51     + ln -s /home/svend/tmp/ikiwiki/wikiwc2 /home/svend/tmp/ikiwiki/wikiwc
52     + mkdir -p /home/svend/tmp/ikiwiki/public_html/wiki/
53     + echo Test
54     + ikiwiki --verbose /home/svend/tmp/ikiwiki/wikiwc /home/svend/tmp/ikiwiki/public_html/wiki/ --url=http://example.org/~you/wiki/ --underlaydir /dev/null
55     + echo '*** Testing with trailing slash.'
56     *** Testing with trailing slash.
57     + rm -rf /home/svend/tmp/ikiwiki/wikiwc2 /home/svend/tmp/ikiwiki/wikiwc /home/svend/tmp/ikiwiki/public_html/wiki/
58     + mkdir -p /home/svend/tmp/ikiwiki/wikiwc2
59     + ln -s /home/svend/tmp/ikiwiki/wikiwc2 /home/svend/tmp/ikiwiki/wikiwc
60     + mkdir -p /home/svend/tmp/ikiwiki/public_html/wiki/
61     + echo Test
62     + ikiwiki --verbose /home/svend/tmp/ikiwiki/wikiwc/ /home/svend/tmp/ikiwiki/public_html/wiki/ --url=http://example.org/~you/wiki/ --underlaydir /dev/null
63     scanning index.mdwn
64     rendering index.mdwn
65
66 Note that index.mdwn was only rendered when srcdir had a trailing slash.
67
68 > There are potential [[security]] issues with ikiwiki following a symlink,
69 > even if it's just a symlink at the top level of the srcdir.
70 > Consider ikiwiki.info's own setup, where the srcdir is ikiwiki/doc,
71 > checked out of revision control. A malicious committer could convert
72 > ikiwiki/doc into a symlink to /etc, then ikiwiki would happily publish
73 > all of /etc to the web.
74
75 > This kind of attack is why ikiwiki does not let File::Find follow
76 > symlinks when scanning the srcdir. By appending the slash, you're
77 > actually bypassing that check. Ikiwiki should not let you set
78 > up a potentially insecure configuration like that. More discussion of
79 > this hole [[here|security#index29h2]], and I've had to release
80 > a version of ikiwiki that explicitly checks for that, and fails to work.
81 > Sorry, but security trumps convenience. [[done]] --[[Joey]]