[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-149.0a1-16.0-2] fixup! TB 43817: Add tests for Tor Browser



Title: GitLab

brizental pushed to branch tor-browser-149.0a1-16.0-2 at The Tor Project / Applications / Tor Browser

Commits:

  • 6e0af488
    by Beatriz Rizental at 2026-04-01T11:42:51-03:00
    fixup! TB 43817: Add tests for Tor Browser
    
    Bug 44800: Use our own ip checker service on the stream isolation test
    

1 changed file:

Changes:

  • testing/tor/test_circuit_isolation.py
    ... ... @@ -47,12 +47,30 @@ class TestCircuitIsolation(MarionetteTestCase, TorBrowserMixin):
    47 47
                 ).strip()
    
    48 48
             )
    
    49 49
     
    
    50
    +    def extract_from_header(self, url):
    
    51
    +        # Navigate to the page to bypass CORS.
    
    52
    +        self.marionette.navigate(url)
    
    53
    +        # The IP checker service provided by TPA, return the caller IP address
    
    54
    +        # on the head of the response, inside the `X-Your-IP-Address` header.
    
    55
    +        return ip_address(
    
    56
    +            self.marionette.execute_async_script(
    
    57
    +                """
    
    58
    +                const [url, resolve] = arguments;
    
    59
    +
    
    60
    +                fetch(url).then(response =>
    
    61
    +                    resolve(response.headers.get("X-Your-IP-Address"))
    
    62
    +                );
    
    63
    +                """,
    
    64
    +                script_args=[url],
    
    65
    +            )
    
    66
    +        )
    
    67
    +
    
    50 68
         def test_circuit_isolation(self):
    
    51 69
             self.bootstrap()
    
    52 70
             ips = [
    
    53 71
                 self.extract_from_check_tpo(),
    
    54 72
                 self.extract_generic("https://am.i.mullvad.net/ip"),
    
    55
    -            self.extract_generic("https://v4.ident.me"),
    
    73
    +            self.extract_from_header("https://test.torproject.org"),
    
    56 74
             ]
    
    57 75
             self.logger.info(f"Found the following IP addresses: {ips}")
    
    58 76
             unique_ips = set(ips)
    
    ... ... @@ -63,11 +81,16 @@ class TestCircuitIsolation(MarionetteTestCase, TorBrowserMixin):
    63 81
                 "Some of the IP addresses we got are not unique.",
    
    64 82
             )
    
    65 83
     
    
    66
    -        # TODO: Renable the duplicate check once
    
    67
    -        # https://gitlab.torproject.org/tpo/tpa/team/-/issues/42547 is resolved.
    
    68
    -        # duplicate = self.extract_generic("https://test2.ifconfig.me/ip")
    
    69
    -        # self.assertEqual(
    
    70
    -        #     ips[-1],
    
    71
    -        #     duplicate,
    
    72
    -        #     "Two IPs that were expected to be equal are different, we might be over isolating!",
    
    73
    -        # )
    84
    +        duplicates = set(
    
    85
    +            self.extract_from_header("https://test-01.torproject.org"),
    
    86
    +            self.extract_from_header("https://test-02.torproject.org"),
    
    87
    +            self.extract_from_header("https://test.torproject.org"),
    
    88
    +        )
    
    89
    +        self.logger.info(
    
    90
    +            f"Found the following IP addresses, when checking for duplicates: {duplicates}"
    
    91
    +        )
    
    92
    +        self.assertEqual(
    
    93
    +            len(duplicates),
    
    94
    +            1,
    
    95
    +            "IPs that were expected to be equal are different, we might be over isolating!",
    
    96
    +        )

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx