hmeine / pdfdecanter

PDF-based presentation program
Apache License 2.0
1 stars 0 forks source link

Cache file should not be put into system-wide temp. directory #1

Closed hmeine closed 10 years ago

hmeine commented 12 years ago

Currently, the rendered presentation is put into tempfile.gettempdir(). I immediately added the warning

ATTENTION! unpickling from system-wide tempdir is a security risk!

because I knew this was a bad thing security-wise. (Actually, pickling is not optimal at all, but soooo convenient. I had a working HDF5-based solution before, which you can find in the history, but pickling would be simpler, I think faster, and definitely lead to smaller files. The disadvantage of pickling is that you have no control about what kind of objects you actually get, and that arbitrary code might be executed.)

However, the global temp dir has the advantage that it will most probably be cleaned eventually by the system or some helper programs.

DESIGN GOALS Note that our cache files are quite short-lived, and are mostly meant to speed up multiple presentations of the same file within a time scale of one or two days. In particular, it speeds up development of this program itself, and helps with setting up the right presentation environment.

IDEAS We should obviously use a user-specific path, the downside of which is that it will not be cleaned up automatically. (Maybe we can reuse something like KDE's kde-$USER temp directories if present, but that would not work everywhere.) So we would need to implement our own mechanisms at the same time to

using command line arguments. We might also add a switch to disable the caching altogether, and an option to configure the cache path.

hmeine commented 11 years ago

I have recently made the cache location default to the directory the PDF is in. What's still missing would be --cache-path and possibly --cache-dir commandline options.

As the cache files become smaller and smaller, being short-lived is not that important anymore.