]> sipb.mit.edu Git - ikiwiki.git/blob - doc/forum/index_attachments/comment_2._comment
reply - search attachments
[ikiwiki.git] / doc / forum / index_attachments / comment_2._comment
1 [[!comment format=mdwn
2  nickname="jerojasro"
3  subject="RE: comment 1"
4  date="2012-01-15T23:49:49Z"
5  content="""
6 I've modified the plugin adding the possibility of indexing attachments. Only
7 PDF attachments for now, but support for other filetypes should be real easy to add.
8
9 The changes to `IkiWiki/Plugin/search.pm` are available at
10 <http://git.devnull.li/ikiwiki.git>, in the `srchatt` branch.
11
12 I have a small question about filenames and security: I'm using `qx` to execute
13 the program that extracts the text from the PDF files, but `qx` executes a
14 whole string, and passes it not to the program I want to run, but to a shell,
15 so it is possible (I think) to craft a filename that, in a shell, expands to
16 something nasty.
17
18 How do the Perl/IkiWiki experts suggest to handle these potentially unsafe
19 filenames? I've thought of the following options:
20
21   * Running the text extractor program using `Proc::Safe`. I could not find a
22     Debian package for it, and I'd rather avoid adding another dependency to
23     IkiWiki.
24   * Running the text extractor program as suggested in the `perlipc` document,
25     using `fork` + `exec`.
26
27 I haven't done any of those because I'd like to check if there are any helpers
28 in IkiWiki to do this. Perhaps the `IkiWiki::possibly_foolish_untaint` function
29 does it? (I didn't really understand what it does...)
30 """]]