access rights in the cache directory

Issue #375 resolved
Jens-Uwe Grooß created an issue

The mss UI saves the figure data in the cache directory, e.g. /tmp/.cache/.mss/msui/ On first use this directory is created If more than one person is using this on the same system, this does create access probelms. The second user is not allowed to write to the same directory.

This was even the case if the cache box was unticked. It should be ensured that there will be no conflict, either by generally setting write permissions to this directory or by creating individual cache directories.

Comments (11)

  1. Jens-Uwe Grooß reporter

    Since the cache dir can be defined in the file mss_settings.json this problem could be avoided. However, an intelligent way needs to be found to define better the default cache directory.

  2. Reimar Bauer

    We have set a default but any user can overwrite it in his configurations, If we change that default, we need a path which on all circumstances works again. The current behaviour is documented as default: https://mss.readthedocs.io/en/stable/usage.html

    This problem usually occures if someone else installs the software and a new user did not read anything. This is a common path on e.g. debian packages.

    A better solution may be that we have on first call of mss a configuration done by the user, where he has to answer some questions and gets by that the config updated. As we have json as config, we should look for some flatland like qt interface that generates a form from an existing configuration.

    We may be also want different kind of installations and configs described. The installation one for all isn't described yet.

  3. Joern Ungermann

    Okay, I looked into our code and while not XDG compliant, I think our chosen path is safe and sound:

    wms_cache = os.path.join(tempfile.gettempdir(), "msui_wms_cache")
    

    which is a unique temporary directory. Is the issue related to a "misconfiguration", i.e. was the same cache directory configured for all seats? I was under the impressions that we had a bug here. A joint directory should not work, simply for security reasons. So I am confused, how to proceed here.

  4. Jens-Uwe Grooß reporter

    Yes, I think, the issue is related to this kind of configuration. The default configuration was used on a shared user system and I didn't realize, that the path to the cache die was in the settings file.

    Is is possible to check if the user owns the cache dir, and if not, terminate with an error message, that the path needs to be adapted?

  5. Reimar Bauer

    @grooss if we won't set a config var for that case than it had worked out of the box. At the moment we don't have a config file checker, besides that we expect valid json.

    It may be a nice feature to verify some essential parts on each startup of mss. e.g. data_dir, wms_cache

  6. Log in to comment