Skip to content

Commit

Permalink
Probe Report should not leak the full PATH.
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Aug 13, 2014
1 parent 3f68f15 commit c6eb5c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ooni/nettest.py
Expand Up @@ -9,7 +9,7 @@
from twisted.python import usage, reflect

from ooni.tasks import Measurement
from ooni.utils import log, checkForRoot
from ooni.utils import log, checkForRoot, sanitize_options
from ooni.settings import config
from ooni import geoip

Expand Down Expand Up @@ -219,6 +219,7 @@ def testDetails(self):
for input_file in self.inputFiles:
input_file_hashes.append(input_file['hash'])

options = sanitize_options(self.options)
test_details = {'start_time': time.time(),
'probe_asn': config.probe_ip.geodata['asn'],
'probe_cc': config.probe_ip.geodata['countrycode'],
Expand All @@ -228,9 +229,8 @@ def testDetails(self):
'test_version': self.testVersion,
'software_name': 'ooniprobe',
'software_version': software_version,
'options': self.options,
'input_hashes': input_file_hashes,
'geoip_database_version': geoip.database_version()
'options': options,
'input_hashes': input_file_hashes
}
return test_details

Expand Down
11 changes: 11 additions & 0 deletions ooni/utils/__init__.py
Expand Up @@ -131,3 +131,14 @@ def generate_filename(testDetails, prefix=None, extension=None, filename=None):

return final_filename

def sanitize_options(options):
"""
Strips all possible user identifying information from the ooniprobe test
options.
Currently only strips leading directories from filepaths.
"""
sanitized_options = []
for option in options:
option = os.path.basename(option)
sanitized_options.append(option)
return sanitized_options

0 comments on commit c6eb5c4

Please sign in to comment.