-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tor Browser overrides the Accept-Languages
header in the page-layout tests
#7354
Comments
Is this something we should file upstream with https://github.com/webfp/tor-browser-selenium ? |
Good idea, but I should come up with a minimal reproduction based on: --- a/securedrop/tests/functional/web_drivers.py
+++ b/securedrop/tests/functional/web_drivers.py
@@ -50,12 +50,13 @@ def _create_torbrowser_driver(
# we use session cookies in SD anyway (in private browsing mode all
# cookies are set as session cookies), this should not affect session
# lifetime.
- pref_dict = {
- "network.proxy.no_proxies_on": "127.0.0.1",
- "browser.privatebrowsing.autostart": False,
- }
+ torbrowser_options = webdriver.FirefoxOptions()
+ torbrowser_options.set_preference("network.proxy.no_proxies_on", "127.0.0.1")
+ torbrowser_options.set_preference("browser.privatebrowsing.autostart", False)
+ torbrowser_options.set_preference("privacy.resistFingerprinting", False)
if accept_languages is not None:
- pref_dict["intl.accept_languages"] = accept_languages
+ torbrowser_options.set_preference("privacy.spoof_english", False)
+ torbrowser_options.set_preference("intl.accept_languages", accept_languages)
Path(_TBB_PATH).mkdir(parents=True, exist_ok=True)
torbrowser_driver = None
@@ -63,8 +64,8 @@ def _create_torbrowser_driver(
try:
torbrowser_driver = TorBrowserDriver(
_TBB_PATH,
+ options=torbrowser_options,
tor_cfg=cm.USE_RUNNING_TOR,
- pref_dict=pref_dict,
tbb_logfile_path=_LOGFILE_PATH,
)
logging.info("Created Tor Browser web driver") |
I've filed this upstream in webfp/tor-browser-selenium#217. At this point, given the complexity of Tor Browser's handling of these preferences, the next step would to have translation tests use Firefox across the board and use Tor Browser only for true functional testing. |
Description
Tor Browser's anti-fingerprinting protections prevent both profile-based and options-based configuration from overriding the
Accept-Language
header used to test localization in the Source Interface's page-layout tests.Steps to Reproduce
LOCALES="de_DE" make translation-test
.securedrop/tests/functional/pageslayout/screenshots
.Expected Behavior
All screenshots are in German.
Actual Behavior
Journalist Interface screenshots are in German. Source Interface screenshots are in English.
Comments
I tried using Selenium Wire to override the
Accept-Language
header on the wire, but it conflicts withtbselenium
.12tor-browser-accept-languages.txt
Footnotes
https://gist.github.com/woswos/38b921f0b82de009c12c6494db3f50c5?permalink_comment_id=4455252#gistcomment-4455252 ↩
https://github.com/webfp/tor-browser-selenium/discussions/175 ↩
The text was updated successfully, but these errors were encountered: