GNOME Bugzilla – Bug 775639
portal helper should use private data/cache directories
Last modified: 2017-01-24 12:36:42 UTC
A user reports that our captive portal helper just loads www.gnome.org and does nothing else. *Maybe* it's being loaded from disk cache and not hitting the network at all? Portal helper should probably use a WebKitWebsiteDataManager to set a private empty directory for WebKit caches to ensure it's actually hitting the network and not just loading webpages from disk. I think we can keep page cache enabled, that shouldn't hurt anything I think....
Actually this is also important for security, it's bad for captive portals to have access to e.g. IndexedDB from other WebKit apps.
The way to fix this is to create a WebKitWebsiteDataManager setting the base-data-directory and base-cache-directory properties at construct time, then create a WebKitWebContext using webkit_web_context_new_with_website_data_manager, then use that WebKitWebContext to create the WebKitWebView using webkit_web_view_new_with_context. Currently portal helper is using the global default web context which gives itself access to all data from any other WebKit applications on the system that do not set these properties. I guess base-data-directory and base-cache-directory should be set by g_mkdtmp or similar.
The patches in bug 752534 could fix this by making the temp directory be private/in memory.
(The default paths should really be changed regardless, it's a five-minute project for anyone already working on portal helper.)
Created attachment 344016 [details] [review] portalHelper: Use private data/cache directories
Not sure why, but I always end up with *1* file left in the cache.
Created attachment 344017 [details] [review] portalHelper: Use private data/cache directories
Created attachment 344018 [details] [review] portalHelper: Use private data/cache directories
Review of attachment 344018 [details] [review]: Yup, exactly. And using WebKit.CacheModel.DOCUMENT_VIEWER to disable disk cache was a good idea too.
Attachment 344018 [details] pushed as 2ff988e - portalHelper: Use private data/cache directories