[results-processor] will overwrite files when extracting from a ZIP #4066
Description
In the following:
wpt.fyi/results-processor/processor.py
Lines 200 to 210 in d6339c4
There's nothing stopping us from overwriting files that already exist when extracting, and it's hard to check for in advance given ZipFile.extract
does some normalization of the path.
This would be bad if someone uploaded archive1.zip
and archive2.zip
, both containing wptreport.json
and wptscreenshot.txt
, which feels like a totally sensible thing to do.
We should probably just create a new temporary directory within self._temp_dir
(via tempdir.mkdtemp(dir=self._temp_dir)
for each archive file we're processing, and extract into that. This still isn't totally safe, but for there to be any risk you really need someone trying to be malicious.