Ticket #6293: check-proxy-running-in-tor-proxy.patch

File check-proxy-running-in-tor-proxy.patch, 1.8 KB (added by jct, 6 years ago)

Patch in order to checking if the proxy is running in a Tor Proxy browser and disable it.

  • proxy/flashproxy.js

    From 7bfc05f96d8f086b13f4d693ebecedc7034bf60b Mon Sep 17 00:00:00 2001
    From: Jorge Couchet <jorge.couchet@gmail.com>
    Date: Thu, 22 Nov 2012 13:08:36 +0100
    Subject: [PATCH] Checking if the proxy is running in a Tor Proxy and
     disabling itelf.
    
    ---
     proxy/flashproxy.js |   24 ++++++++++++++++++++++++
     1 file changed, 24 insertions(+)
    
    diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js
    index 2078b69..435b8ea 100644
    a b function repr(x) { 
    865865    }
    866866}
    867867
     868/* The function is trying to detect that the proxy is running in a Tor Browser. A Tor Browser has
     869   an specific 'navigator.userAgent' string, it is also entirely disabling the DOM storage and
     870   not listing the supported MIME types.
     871
     872   https://trac.torproject.org/projects/tor/ticket/6293
     873
     874*/
     875function is_likely_tor_browser() {
     876
     877        var isTB = false;
     878
     879        if ( (navigator.userAgent == "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0") && (sessionStorage === null) && (navigator.mimeTypes.length == 0) )
     880          isTB = true;
     881
     882        return isTB;
     883}
     884
    868885/* Are circumstances such that we should self-disable and not be a
    869886   proxy? We take a best-effort guess as to whether this device runs on
    870887   a battery or the data transfer might be expensive.
    function repr(x) { 
    876893function flashproxy_should_disable() {
    877894    var ua;
    878895
     896    /* If the proxy is running in a Tor Browser there is a possible security problem:
     897          It is reported at: https://trac.torproject.org/projects/tor/ticket/6293  */
     898    if (is_likely_tor_browser()) {
     899         puts("Disable because is running in a Tor Browser.");
     900         return true;
     901    }
     902
    879903    ua = window.navigator.userAgent;
    880904    if (ua !== null) {
    881905        var UA_LIST = [