entity capabilities cache must not be collocated with executable code

Issue #16 closed
Markus KARG created an issue

Since Windows Vista, the Windows operating system family has rather restricted security defaults. On of these defaults is that only system administrators, and even only when acting in an elevated mode, are allows to write into the location where executable code is stored (i. e. %ProgramFiles% and %ProgramFiles(x86)% folders). The aim is that viruses will fail conatimating executable code.

Unfortunately the Babbler library tries to write cache information collocated to the using application. This leads to the fact that an exception happens due to missing access rights:

Feb 05, 2015 11:09:48 AM rocks.xmpp.extensions.caps.EntityCapabilitiesManager wr iteToCache WARNUNG: Could not write entity capabilities to persistent cache. Reason: java.i o.FileNotFoundException: cache\caps\77d6fe485d274c11c97fb609c646a73e244fe065.cap s (Das System kann den angegebenen Pfad nicht finden) java.lang.RuntimeException: java.io.FileNotFoundException: cache\caps\77d6fe485d 274c11c97fb609c646a73e244fe065.caps (Das System kann den angegebenen Pfad nicht finden) at rocks.xmpp.core.util.cache.DirectoryCache.put(DirectoryCache.java:117 ) at rocks.xmpp.extensions.caps.EntityCapabilitiesManager.writeToCache(Ent ityCapabilitiesManager.java:285) at rocks.xmpp.extensions.caps.EntityCapabilitiesManager.access$400(Entit yCapabilitiesManager.java:85) at rocks.xmpp.extensions.caps.EntityCapabilitiesManager$4.run(EntityCapa bilitiesManager.java:398) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.FileNotFoundException: cache\caps\77d6fe485d274c11c97fb609c64 6a73e244fe065.caps (Das System kann den angegebenen Pfad nicht finden) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(Unknown Source) at java.io.FileOutputStream.<init>(Unknown Source) at java.io.FileOutputStream.<init>(Unknown Source) at rocks.xmpp.core.util.cache.DirectoryCache.put(DirectoryCache.java:114 )

The correct solution is to explicitly store this information in the program's profile (on Windows, this is %ProgramData%) or the user's profile (on Windows, this is %AppData%). Both places are the official places where user processed may write into by default.

Comments (4)

  1. Christian Schudt repo owner

    You can change the directory in the XmppSessionConfiguration (cacheDirectory()). Do you think this is sufficient? I hesitate to hardcode some Windows-specific settings or use Windows-specific environment variables.

  2. Log in to comment