Bug 1331129 - address unexpected file accesses r=jmaher

MozReview-Commit-ID: owjXhFvMV0

--HG--
extra : rebase_source : d505305b4c3395f9967c531b31b3bcbaba626663
This commit is contained in:
Ionut Goldan 2017-09-05 17:38:26 +03:00
Родитель 3098df1a89
Коммит c948f97eb8
4 изменённых файлов: 95 добавлений и 11 удалений

Просмотреть файл

@ -205,8 +205,8 @@ GLOBAL_OVERRIDES = (
'gecko_profile',
'gecko_profile_interval',
'gecko_profile_entries',
'rss',
'mainthread',
'rss',
'shutdown',
'tpcycles',
'tpdelay',

Просмотреть файл

@ -5,9 +5,12 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import re
import utils
import whitelist
from collections import OrderedDict
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
STAGE_STARTUP = 0
@ -29,12 +32,23 @@ KEY_RUN_COUNT = 'RunCount'
LEAKED_SYMLINK_PREFIX = "::\\{"
PATH_SUBSTITUTIONS = {'profile': '{profile}', 'firefox': '{xre}',
'desktop': '{desktop}',
'fonts': '{fonts}', 'appdata': ' {appdata}'}
NAME_SUBSTITUTIONS = {'installtime': '{time}', 'prefetch': '{prefetch}',
'thumbnails': '{thumbnails}',
'windows media player': '{media_player}'}
PATH_SUBSTITUTIONS = OrderedDict([
('profile', '{profile}'),
('firefox', '{xre}'),
('desktop', '{desktop}'),
('fonts', '{fonts}'),
('appdata', ' {appdata}')])
NAME_SUBSTITUTIONS = OrderedDict([
('installtime', '{time}'),
('prefetch', '{prefetch}'),
('thumbnails', '{thumbnails}'),
# {appdata}\locallow\mozilla\temp-{*}
('temp-{', '{temp}'),
('cltbld.', '{cltbld}'),
('windows media player', '{media_player}'),
# regex order matters
(re.compile(r'{\w{8}-\w{4}-\w{4}-\w{4}-\w{12}}'), '{uuid}'),
(re.compile(r'{uuid}\.\d+\.ver\w+\.db'), '{uuid-db}')])
TUPLE_FILENAME_INDEX = 2
WHITELIST_FILENAME = os.path.join(SCRIPT_DIR, 'mtio-whitelist.json')

Просмотреть файл

@ -77,8 +77,17 @@
"{profile}\\cookies.sqlite-journal": {},
"{profile}\\cookies.sqlite-shm": {},
"{profile}\\cookies.sqlite-wal": {},
"{profile}\\extensions\\talos-powers@mozilla.org.xpi": {},
"{profile}\\extensions\\pageloader@mozilla.org.xpi\\searchplugins": {},
"{profile}\\extensions\\talos-powers@mozilla.org.xpi\\manifest.json": {},
"{profile}\\extensions\\pageloader@mozilla.org.xpi": {},
"{profile}\\extensions\\pageloader@mozilla.org.xpi\\manifest.json": {},
"{profile}\\extensions\\talos-powers@mozilla.org.xpi\\searchplugins": {},
"{profile}\\extensions\\talos-powers@mozilla.org.xpi\\install.rdf": {},
"{profile}\\extensions\\pageloader@mozilla.org.xpi\\install.rdf": {},
"{profile}\\extensions\\pageloader@mozilla.org": {},
"{profile}\\extensions\\pageloader@mozilla.org\\plugins": {},
"{profile}\\extensions\\pageloader@mozilla.org\\install.rdf": {},
"{profile}\\extensions\\pageloader@mozilla.org\\searchplugins": {},
"{profile}\\extensions\\pageloader@mozilla.org\\chrome\\profiler.js": {},
"{profile}\\extensions\\pageloader@mozilla.org\\chrome\\tscroll.js": {},
@ -89,6 +98,8 @@
"{profile}\\extensions\\talos-powers@mozilla.org\\searchplugins": {},
"{profile}\\extensions\\talos-powers@mozilla.org\\chrome\\talos-powers-content.js": {},
"{profile}\\extensions\\talos-powers@mozilla.org\\components\\TalosPowersService.js": {},
"{profile}\\extensions\\talos-powers@mozilla.org\\install.rdf": {},
"{profile}\\favicons.sqlite-shm": {},
"{profile}\\key3.db": {},
"{profile}\\localstore-1.rdf": {},
"{profile}\\localstore.rdf": {},
@ -96,6 +107,7 @@
"{profile}\\pluginreg.dat.tmp": {},
"{profile}\\plugins": {},
"{profile}\\places.sqlite": {},
"{profile}\\places.sqlite-shm": {},
"{profile}\\places.sqlite-journal": {},
"{profile}\\places.sqlite-wal": {},
"{profile}\\favicons.sqlite": {},
@ -105,12 +117,58 @@
"{profile}\\prefs.js": {},
"{profile}\\searchplugins": {},
"{profile}\\secmod.db": {},
"{profile}\\startupcache": {},
"{profile}\\startupCache\\startupCache.4.little": {},
"{profile}\\cache2\\index": {},
"{profile}\\cache2\\index.log": {},
"{profile}\\cache2\\index.tmp": {},
"{profile}\\Telemetry.ShutdownTime.txt.tmp": {},
"{profile}\\{thumbnails}": {},
"{xre}\\browser\\extensions\\{uuid}.xpi\\manifest.json": {},
"{xre}\\browser\\extensions\\{uuid}.xpi\\install.rdf": {},
"{xre}\\browser\\extensions\\{uuid}.xpi": {},
"{xre}\\browser\\features\\formautofill@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\activity-stream@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\clicktoplay-rollout@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\presentation@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\shield-recipe-client@mozilla.org.xpi": {},
"{xre}\\browser\\features\\formautofill@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\flyweb@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\onboarding@mozilla.org.xpi": {},
"{xre}\\browser\\features\\flyweb@mozilla.org.xpi": {},
"{xre}\\browser\\features\\formautofill@mozilla.org.xpi": {},
"{xre}\\browser\\features\\screenshots@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\onboarding@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\followonsearch@mozilla.com.xpi\\install.rdf": {},
"{xre}\\browser\\features\\screenshots@mozilla.org.xpi": {},
"{xre}\\browser\\features\\followonsearch@mozilla.com.xpi\\manifest.json": {},
"{xre}\\browser\\features\\activity-stream@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\shield-recipe-client@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\firefox@getpocket.com.xpi\\manifest.json": {},
"{xre}\\browser\\features\\webcompat-reporter@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\webcompat@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\aushelper@mozilla.org.xpi": {},
"{xre}\\browser\\features\\e10srollout@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\presentation@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\e10srollout@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\clicktoplay-rollout@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\webcompat-reporter@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\aushelper@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\firefox@getpocket.com.xpi": {},
"{xre}\\browser\\features\\e10srollout@mozilla.org.xpi": {},
"{xre}\\browser\\features\\flyweb@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\presentation@mozilla.org.xpi": {},
"{xre}\\browser\\features\\aushelper@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\followonsearch@mozilla.com.xpi": {},
"{xre}\\browser\\features\\activity-stream@mozilla.org.xpi": {},
"{xre}\\browser\\features\\screenshots@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\webcompat@mozilla.org.xpi": {},
"{xre}\\browser\\features\\webcompat-reporter@mozilla.org.xpi": {},
"{xre}\\browser\\features\\onboarding@mozilla.org.xpi\\manifest.json": {},
"{xre}\\browser\\features\\firefox@getpocket.com.xpi\\install.rdf": {},
"{xre}\\browser\\features\\webcompat@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\features\\clicktoplay-rollout@mozilla.org.xpi": {},
"{xre}\\browser\\features\\shield-recipe-client@mozilla.org.xpi\\install.rdf": {},
"{xre}\\browser\\plugins": {},
"{xre}\\browser\\searchplugins": {},
"{xre}\\browser\\searchplugins\\yahoo.xml": {},
@ -122,6 +180,7 @@
"{xre}\\browser\\searchplugins\\google.xml": {},
"{xre}\\browser\\searchplugins\\wikipedia.xml": {},
"{xre}\\distribution\\searchplugins": {},
"{xre}\\pingsender.exe": {},
"c:\\users": {},
"C:\\windows\\system32\\propsys.dll": {},
"C:\\Program Files\\NVIDIA Corporation\\3D Vision": {},
@ -134,10 +193,15 @@
"{AppData}": {},
"{AppData}\\local": {},
"{AppData}\\local\\temp": {},
"{appdata}\\local\\microsoft\\windows\\caches": {},
"{appdata}\\local\\microsoft\\windows\\caches\\{uuid-db}": {},
"{appdata}\\local\\microsoft\\windows\\caches\\cversions.1.db": {},
"{AppData}\\locallow\\mozilla": {},
"{appdata}\\locallow\\mozilla\\{temp}": {},
"{AppData}\\Roaming": {},
"{AppData}\\roaming\\temp": {},
"{AppData}\\roaming\\mozilla": {},
"{appdata}\\roaming\\mozilla\\extensions\\{uuid}": {},
"{AppData}\\roaming\\mozilla\\plugins": {},
"{AppData}\\Roaming\\Microsoft": {},
"{AppData}\\Roaming\\Microsoft\\desktop.ini": {},
@ -150,5 +214,7 @@
"C:\\Users\\desktop.ini": {},
"C:\\Users": {},
"C:\\Users\\Public": {},
"C:\\Users\\Public\\desktop.ini": {}
"C:\\Users\\Public\\desktop.ini": {},
"c:\\windows\\system32\\en-us\\kernelbase.dll.mui": {},
"c:\\users\\{cltbld}": {}
}

Просмотреть файл

@ -6,6 +6,7 @@
import json
import os
import re
import utils
KEY_XRE = '{xre}'
@ -70,6 +71,9 @@ class Whitelist:
filename = "%s%s" % (subst, path.join(parts[1:]))
for old_name, new_name in self.name_substitutions.iteritems():
if isinstance(old_name, re._pattern_type):
filename = re.sub(old_name, new_name, filename)
else:
parts = filename.split(old_name)
if len(parts) >= 2:
filename = "%s%s" % (parts[0], new_name)