]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/optional_underlaydir_prefix.mdwn
good idea
[ikiwiki.git] / doc / todo / optional_underlaydir_prefix.mdwn
1 For security reasons, symlinks are disabled in IkiWiki.  That's fair enough, but that means that some problems, which one could otherwise solve by using a symlink, cannot be solved. The specfic problem in this case is that all underlays are placed at the root of the wiki, when it could be more convenient to place some underlays in specific sub-directories.
2
3 Use-case 1 (to keep things tidy):
4
5 Currently IkiWiki has some javascript files in `underlays/javascript`; that directory is given as one of the underlay directories.  Thus, all the javascript files appear in the root of the generated site.  But it would be tidier if one could say "put the contents of *this* underlaydir under the `js` directory".
6
7 > Of course, this could be accomplished, if we wanted to, by moving the
8 > files to `underlays/javascript/js`. --[[Joey]] 
9
10 Use-case 2 (a read-only external dir):
11
12 Suppose I want to include a subset of `/usr/local/share/docs` on my wiki, say the docs about `foo`.  But I want them to be under the `docs/foo` sub-directory on the generated site.  Currently I can't do that.  If I give `/usr/local/share/docs/foo` as an underlaydir, then the contents of that will be in the root of the site, rather than under `docs/foo`.  And if I give `/usr/local/share/docs` as an underlaydir, then the contents of the `foo` dir will be under `foo`, but it will also include every other thing in `/usr/local/share/docs`.
13
14 Since we can't use symlinks in an underlay dir to link to these directories, then perhaps one could give a specific underlay dir a specific prefix, which defines the sub-directory that the underlay should appear in.
15
16 I'm not sure how this would be implemented, but I guess it could be configured something like this:
17
18     prefixed_underlay => {
19          'js' => '/usr/local/share/ikiwiki/javascript',
20          'docs/foo' => '/usr/local/share/docs/foo',
21     }
22
23 > So, let me review why symlinks are an issue. For normal, non-underlay
24 > pages, users who do not have filesystem access to the server may have 
25 > commit access, and so could commit eg, a symlink to `/etc/passwd` (or
26 > to `/` !). The guards are there to prevent ikiwiki either exposing the
27 > symlink target's contents, or potentially overwriting it.
28
29 > Is this a concern for underlays? Most of the time, certianly not;
30 > the underlay tends to be something only the site admin controls.
31 > Not all the security checks that are done on the srcdir are done
32 > on the underlays, either. Most checks done on files in the underlay
33 > are only done because the same code handles srcdir files. The one
34 > exception is the test that skips processing symlinks in the underlay dir.
35 > (But note that the underlay directory can be a symlinkt to elsewhere
36 > which the srcdir, by default, cannot.)
37
38 > So, one way to approach this is to make ikiwiki follow directory symlinks
39 > inside the underlay directory. Just a matter of passing `follow => 1` to
40 > find. (This would still not allow individual files to be symlinks, because
41 > `readfile` does not allow reading symlinks. But I don't see much need
42 > for that.) --[[Joey]]
43
44 >> If you think that enabling symlinks in underlay directories wouldn't be a security issue, then I'm all for it!  That would be much simpler to implement, I'm sure. --[[KathrynAndersen]]
45
46 [[!taglink wishlist]]