openwpm/OpenWPM

Block webdriver html attribute from getting set

dreisman opened this issue · 5 comments

Selenium adds an HTML attribute "webdriver = true" to the tag. This should be removed before any scripts on the page are executed.

(also, measuring how many sites/scripts check for this attribute would be informative)

Please check #105. It should remove the webdriver attribute set by Selenium.

Thanks Gunes! A few comments:

(1) We should really have an automated test for this. If it does break in the future for some reason it's unlikely to be noticed by an user of the platform

(2) In order to activate, the user must set browser_params['extension']['enabled'] = True and browser_params['extension']['jsInstrument'] = True. We shouldn't tie the protection to the use of instrumentation.

Since we're planning to move to extension-only instrumentation as soon as possible, I think it makes sense to have the extension on by default. Once that's set, we should make a separate content script which does nothing other than inject the webdriver protection code. I'll make an issue to track this change as well.

@gunesacar take a look at 54765c1. It seems we don't always load before selenium so we need a bit of extra handling. I think we can use Object.prototype.watch() and Object.prototype.unwatch() for the navigator.webdriver example.

See: #108 for the fix.