]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/plugins/contrib/compile/discussion.mdwn
About the unmaintained compile plugin
[git.ikiwiki.info.git] / doc / plugins / contrib / compile / discussion.mdwn
1 This plugin sounds exactly like what I need! I too have sources I want to compile on the fly,
2 such as diagrams made with Dia and perhaps API reference manuals made with Doxygen.
4 I'd like to use it, but -
6 Problem: Any user can change the command to something dangerous that deletes file and
7 causes irreversible damage to the system. I can even happen by mistake.
9 Suggestion: Add an option to the setup file that forbids to override the build command in the
10 directive, and then only the setup file can configure build commands (if you want). Another
11 idea, an option to validate the build command, either against a regex or using an arbitrary
12 script specified in setup file - then e.g. you can choose which commands are allowed.
14 What do you think?
16 -- [[fr33domlover]]
18 > The problem you mention is known, and is not a problem for me, since I am the
19 only user of the wiki. However, if we need a *secure* version of this
20 command...
21 >
22 > Imagine we have a setup option `compile_unsecure`.
23 >
24 > The directive takes the following arguments 
25 >
26 > - filetype: No problem.
27 > - build: Forbidden.
28 > - source: No problem.
29 > - template: No problem.
30 > - destname and files: The problem is that right now, the command is run using a shell
31 >   call. Thus, a user can easily use this argument to inject malicious
32 >   commands (something like \[[!compile files=";rm -fr *"]] (well, this
33 >   actually would not work, but you get the idea)). I do want to keep the
34 >   ability to use shell commands, for the flexibility it provides, but I imagine
35 >   we can:
36 >   - interpret the `build` command depending on its type:
37 >     - if it is a string, it is interpreted as a shell command;
38 >     - if it is a list of strings, the first one is the command to execute,
39 >       the following ones are the arguments. If I am not wrong, this should
40 >       prevent command injection.
41 >     - if it is a list of lists of strings, it is a list of commands to
42 >       execute (execution being stopped on the first error; usefull for stuff
43 >       like `latex foo.tex && dvipdf foo.dvi`).
44 >   - the `compile_unsecure` would:
45 >     - forbid commands to be strings (thus, forbidding shell commands, and preventing command injections);
46 >     - forbid compilation using Makefile or executable present in the wiki (to prevent users from modifying those files, and executing arbitrary commands);
47 >     - forbid directive argument `build`.
48 >
49 >
50 > Any thoughts?
51 >
52 > -- [[Louis|spalax]]
54 ---
56 <span id="status">
57 # This plugin is unmaintained
58 </span>
60 Unfortunately, since [[I am no longer using Ikiwiki|forum/Some_thoughts_about_Ikiwiki/]], this plugin is unmaintained. I had great ideas for a new version of this plugin (and [started some work](https://atelier.gresille.org/projects/gresille-ikiwiki/repository?utf8=%E2%9C%93&rev=compile2)), but I will not finish this work. I am dumping my TODO list for this plugin (in French) for those who might be interested.
62 [[!toggle id="TODO" text="See the TODO list."]]
64 [[!toggleable id="TODO" text="""
65   - [ ] Ajouter un test slideshow avec un minimum de code utilisateur
66     - http://slidesjs.com/
67     - https://stackoverflow.com/questions/12912048/how-to-maintain-aspect-ratio-using-html-img-tag
68   - [x] Faire aussi des tests qui utilisent le YAML du setup
69   - [ ] Se déparrasser des ``DEST_XXX_URL``.
70   - [ ] Se débarrasser des listes de ``config[destname]``.
71   - [x] supprimer source, nosource.
72   - [x] Voir si on supprime `make`
73   - [ ] Voir si la configuration ne peut pas se faire en YAML
74     - [x] Non
75     - [ ] Utiliser du YAML.
76   - [ ] Renommer
77     - [ ] type = rule
78     - [ ] destname = dest
79     - [ ] filenames = src
80     - [ ] ??
81   - [ ] Parser correctement la configuration (fichier de setup + arguments de la directive)
82   - [ ] Traiter src comme un pagespec? Au moins comme un glob?
83   - [ ] Variables :
84     - Génériques :
85       - pagedir: sub/page
86       - tmpdir: /home/user/wiki/.ikiwiki/3840938038409
87       - wikidir: /home/user/wiki
88       - destdir: $config{destdir}
89       - id: un identifiant unique ?
90     - Fichiers :
91       - Variables
92         - PAS DE `SRC*`: TOUT DANS DEST
93         - destname: foo.pdf ($destbasename.$destextension)
94         - destbasename: foo
95         - destextension: pdf
96         - desturl: http://...foo.pdf
97         - destwikiname: sub/page/foo/foo.pdf ($dirname/$destname)
98         - destfullname: /var/www/wiki/sub/page/foo/foo.pdf ($destdir/$destwikiname)
99         - destcontent: contenu de foo.pdf
100       - Variations
101         - destname0, destname1: premier, deuxième fichier source
102         - idem pour les autres variables
103         - destnamelist: liste des fichiers sources, tels qu'accessibles depuis le répertoire temporaire (shell, pour la commande seulement)
104         - destlist: liste des fichiers sources (en utilisant HTML::Template, pour les templates seulement)
105   - [ ] Traiter ``destname`` comme un glob.
106     - [ ] Accéder au premier destname avec DESTNAME.
107     - [ ] Accéder à tous les destname avec DESTNAME0, DESTNAME1, etc.
108     - [ ] Accéder à une liste de destname utilisable dans un `<TMPL_LOOP>`
109   - [ ] Supprimer les fichiers temporaires au début.
110   - [ ] Créer des dossiers temporaires en fonction du hash de ``SOURCEPAGE/FILES/COMMAND``.
111   - [ ] Ne pas re-compiler si le répertoire existe déjà.
112   - [ ] destname ne renomme pas le fichier : il sélectionne quel fichier publier.
113   - [ ] Mais fournir des templates par défaut :
114     - [ ] `compile_source`
115     - [ ] `compile_link` (avec des `var_text` et `var_srctext`)
116     - [ ] `compile_album` (avec un `var_width` et `var_height` et un `slideshow.js` seulement en exemple)
117     - [ ] `compile_raw`
118   - [ ] Doc: Fournir des exemples de règles
119     - [ ] gimp, libreoffice, latex, album, etc.
120   - [ ] Le fichier source n'est pas copié par défaut: si on en a besoin, il faut le mentionner dans les destnames.
121   - [ ] Documentation
122     - [ ] Slideshow (sans compilation)
123     - [ ] Tous les moyens d'accéder aux fichiers (destname, destname0, destnamelist, destlist[destname], etc.)
124   - [ ] Ne pas charger compile2 si compile est activé
125     - [ ] Mettre une option pour forcer
126   - [ ] wikistate: stocker compilé/erreur (rien du tout = pas encore compilé)
127   - [ ] Ajouter un argument `page` pour faire comme si la commande était appelée depuis ladite page?
128   - [ ] Marquer compile comme obsolète
129     - [ ] Source
130     - [ ] Documentation sur ikiwiki
131     - [ ] Warning dans le code
132     - [ ] git tag compile/v0.2
133   - [ ] Prévenir que bibtex2html est obsolète
134 """]]
136 ---
138 # Quick and dirty replacement
140 For those how might be interested: I switched from Ikiwiki to [another static site generator](http://getlektor.com), which does not have a `compile` plugin. Before writing it, I used a quick and dirty solution: using a custom `Makefile`, I use `make build` to build my website, which :
142 - compile the files (e.g. latex documents);
143 - build the website.
145 It started as a quick and dirty fix, but I think I am keeping it.
147 It should work with Ikiwiki too.