openwpm / OpenWPM

A web privacy measurement framework
https://openwpm.readthedocs.io
Other
1.33k stars 313 forks source link

Set custom temporary directory used by FF and delete it #1093

Open ndanner-wesleyancs opened 3 months ago

ndanner-wesleyancs commented 3 months ago

This pull request modifies OpenWPM as follows:

The proximate rationale for doing this is that when geckodriver adds the OpenWPM extension to FF, it makes a copy of the XPI file in its temporary directory. Unfortunately, it doesn't delete it. That means one copy of the XPI file for each browser that is launched is left behind in /tmp. On a big stateless crawl, that's a lot of copies. We can't find out the name of the temporary file that geckodriver creates to delete it ourselves, and we don't want to just delete all XPI files in /tmp because we don't actually know to whom the all belong. This approach seems to resolve these problems.

This patch is based on v.0.28.0.

See #1090.

ndanner-wesleyancs commented 2 months ago

I'll try to work on these in the next couple of weeks.

ndanner-wesleyancs commented 2 months ago

I have fixed the mypy errors.

ndanner-wesleyancs commented 2 months ago

I'm a little perplexed about your suggested test. The original TMPDIR (typically /tmp) could very well have XPI files in it, for example from some other independent process. I'm not sure why we would want to guard against that. If you meant the new TMPDIR, then since it is created by mkdttmp, it is necessarily empty, isn't it?