Enforce cache_path requirements for NetworkService (see issue #2622).

This change adds a new CefSettings.root_cache_path value that must be either
equal to or a parent directory of all CefSettings.cache_path and
CefRequestContextSettings.cache_path values. The sandbox may block read/write
access from the NetworkService to directories that do not meet this requirement.

To test: Run cefclient with a combination of the following flags:

--cache-path=c:\temp\cache
  Cache data should be persisted to the specified directory.

--request-context-per-browser
  A separate numbered cache directory should be created underneath the
  cache-path directory for each new browser instance.

--enable-network-service --disable-extensions
  Same tests, but with NetworkService enabled.

Known issues:
- When NetworkService is enabled a C:\temp\cache\cache\Cache directory is
  created (should be C:\temp\cache\Cache).
This commit is contained in:
Marshall Greenblatt
2019-03-24 14:41:42 -04:00
parent 9b43d265c3
commit b65f336f81
10 changed files with 120 additions and 57 deletions

View File

@@ -73,10 +73,13 @@ class CefContext {
CefTraceSubscriber* GetTraceSubscriber();
// Populate the request context settings based on CefSettings and command-
// line flags.
// Populate request context settings for the global system context based on
// CefSettings and command-line flags.
void PopulateRequestContextSettings(CefRequestContextSettings* settings);
// Verify that |cache_path| is valid and create it if necessary.
bool ValidateCachePath(const base::FilePath& cache_path);
private:
void OnContextInitialized();