[IPOL discuss] file exploited in template html page

Miguel Colom colom at cmla.ens-cachan.fr
Tue Feb 25 15:40:04 CET 2014


Quoting Bertrand Kerautret <bertrand.kerautret at univ-lorraine.fr>:
> Yes perhaps not very difficult. Depending of the answer of @Tech  
> team let me know if you think that I can help to do it. Perhaps  
> following the same process than input with a basic static/index.cfg.
> Bertrand

I've been looking at it and it seems to be trivial to add it.
We need to change the empty_app.py:

Add self.static_dir in the missing subfolder:

         # create the missing subfolders
         for static_dir in [self.input_dir, self.tmp_dir,\
                            self.archive_dir, self.static_dir]:
             if not os.path.isdir(static_dir):
                 os.mkdir(static_dir)

Add a member for the new static folder:
         # static folders
         # cherrypy.tools.staticdir is a decorator,
         # ie a function modifier
         self.input = cherrypy.tools.staticdir(dir=self.input_dir)\
             (lambda x : None)
         self.tmp = cherrypy.tools.staticdir(dir=self.tmp_dir)\
             (lambda x : None)
         self.arc = cherrypy.tools.staticdir(dir=self.archive_dir)\
             (lambda x : None)
         self.static = cherrypy.tools.staticdir(dir=self.static_dir)\
             (lambda x : None)

Add it to the subfolder patterns:
         # subfolder patterns
         # TODO: "path" is the correct syntax
         dir_pattern = {'input_dir' : 'input',
                        'dl_dir' : 'dl',
                        'src_dir' : 'src',
                        'bin_dir' : 'bin',
                        'tmp_dir' : 'tmp',
                        'work_dir' : os.path.join('tmp', self.key),
                        'archive_dir' : 'archive',
                        'static_dir' : 'static'}
         url_pattern = {'base_url' : '/',
                        'input_url' : '/input/',
                        'tmp_url' : '/tmp/',
                        'work_url' : '/tmp/%s/' % self.key,
                        'archive_url' : '/arc/',
                        'static_url' : '/static/'}

After that, we have a .../static/ directory to link any static content.
@Tech and @Edit: do you agree on adding this functionality to the  
production server?

We'll also need to modify the git scripts in order to prevent that  
they remove the "scripts" directory (as we do with the input  
directory, for example).

Miguel




More information about the discuss mailing list