Ticket #9170: 0001-Don-t-log-IP-addresses-by-default-in-flashproxy.js.patch

File 0001-Don-t-log-IP-addresses-by-default-in-flashproxy.js.patch, 5.7 KB (added by arlolra, 6 years ago)
  • facilitator/facilitator

    From b1ea87b18361e5543926ae2c8689acb209f6ba90 Mon Sep 17 00:00:00 2001
    From: Arlo Breault <arlolra@gmail.com>
    Date: Fri, 28 Jun 2013 14:08:51 -0700
    Subject: [PATCH] Don't log IP addresses by default in flashproxy.js
    
    Adds an undocumented query string parameter, unsafe_logging.
    
    See #9170.
    ---
     facilitator/facilitator              |  2 +-
     facilitator/facilitator-email-poller |  2 +-
     facilitator/facilitator-reg-daemon   |  2 +-
     flashproxy-client                    |  2 +-
     proxy/flashproxy.js                  | 25 ++++++++++++++++++-------
     5 files changed, 22 insertions(+), 11 deletions(-)
    
    diff --git a/facilitator/facilitator b/facilitator/facilitator
    index cd3473a..4049dc6 100755
    a b again. Listen on 127.0.0.1 and port PORT (by default %(port)d). 
    6363}
    6464
    6565def safe_str(s):
    66     """Return s if options.safe_logging is true, and "[scrubbed]" otherwise."""
     66    """Return "[scrubbed]" if options.safe_logging is true, and s otherwise."""
    6767    if options.safe_logging:
    6868        return "[scrubbed]"
    6969    else:
  • facilitator/facilitator-email-poller

    diff --git a/facilitator/facilitator-email-poller b/facilitator/facilitator-email-poller
    index 2e6bd4a..1a22b5f 100755
    a b them, and forwards the registrations to the facilitator. 
    114114}
    115115
    116116def safe_str(s):
    117     """Return s if options.safe_logging is true, and "[scrubbed]" otherwise."""
     117    """Return "[scrubbed]" if options.safe_logging is true, and s otherwise."""
    118118    if options.safe_logging:
    119119        return "[scrubbed]"
    120120    else:
  • facilitator/facilitator-reg-daemon

    diff --git a/facilitator/facilitator-reg-daemon b/facilitator/facilitator-reg-daemon
    index bf39696..73d9199 100755
    a b single process. 
    6161}
    6262
    6363def safe_str(s):
    64     """Return s if options.safe_logging is true, and "[scrubbed]" otherwise."""
     64    """Return "[scrubbed]" if options.safe_logging is true, and s otherwise."""
    6565    if options.safe_logging:
    6666        return "[scrubbed]"
    6767    else:
  • flashproxy-client

    diff --git a/flashproxy-client b/flashproxy-client
    index 7feaefe..080af65 100755
    a b omitted, it uses a public default. 
    121121}
    122122
    123123def safe_str(s):
    124     """Return s if options.safe_logging is true, and "[scrubbed]" otherwise."""
     124    """Return "[scrubbed]" if options.safe_logging is true, and s otherwise."""
    125125    if options.safe_logging:
    126126        return "[scrubbed]"
    127127    else:
  • proxy/flashproxy.js

    diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js
    index 3265a11..248e0e2 100644
    a b var WebSocket = window.WebSocket || window.MozWebSocket; 
    8686var query = parse_query_string(window.location.search.substr(1));
    8787var cookies = parse_cookie_string(document.cookie);
    8888var DEBUG = get_param_boolean(query, "debug", false);
     89var SAFE_LOGGING = !get_param_boolean(query, "unsafe_logging", false);
    8990var debug_div;
    9091
    9192if (DEBUG) {
    function FlashProxy() { 
    541542
    542543    this.proxy_main = function() {
    543544        var params;
    544         var url;
     545        var base_url, url;
    545546        var xhr;
    546547
    547548        if (this.proxy_pairs.length >= this.max_num_proxy_pairs) {
    function FlashProxy() { 
    554555        /* Clients we're currently handling. */
    555556        for (var i = 0; i < this.proxy_pairs.length; i++)
    556557            params.push(["client", format_addr(this.proxy_pairs[i].client_addr)]);
    557         url = this.fac_url.replace(/\?.*/, "") + "?" + build_query_string(params);
     558        base_url = this.fac_url.replace(/\?.*/, "");
     559        url = base_url + "?" + build_query_string(params);
    558560        xhr = new XMLHttpRequest();
    559561        try {
    560562            xhr.open("GET", url);
    function FlashProxy() { 
    579581                }
    580582            }
    581583        }.bind(this);
     584
     585        /* Remove query string if scrubbing. */
     586        if (SAFE_LOGGING)
     587            url = base_url;
     588
    582589        puts("Facilitator: connecting to " + url + ".");
    583590        xhr.send(null);
    584591    };
    function FlashProxy() { 
    612619        }
    613620        client_addr = parse_addr_spec(response.client);
    614621        if (client_addr === null) {
    615             puts("Error: can't parse client spec " + repr(response.client) + ".");
     622            puts("Error: can't parse client spec " + safe_repr(response.client) + ".");
    616623            return;
    617624        }
    618625        if (!response.relay) {
    function FlashProxy() { 
    621628        }
    622629        relay_addr = parse_addr_spec(response.relay);
    623630        if (relay_addr === null) {
    624             puts("Error: can't parse relay spec " + repr(response.relay) + ".");
     631            puts("Error: can't parse relay spec " + safe_repr(response.relay) + ".");
    625632            return;
    626633        }
    627         puts("Facilitator: got client:" + repr(client_addr) + " "
    628             + "relay:" + repr(relay_addr) + ".");
     634        puts("Facilitator: got client:" + safe_repr(client_addr) + " "
     635            + "relay:" + safe_repr(relay_addr) + ".");
    629636
    630637        this.begin_proxy(client_addr, relay_addr);
    631638    };
    function FlashProxy() { 
    653660        try {
    654661            proxy_pair.connect();
    655662        } catch (err) {
    656             puts("ProxyPair: exception while connecting: " + repr(err.message) + ".");
     663            puts("ProxyPair: exception while connecting: " + safe_repr(err.message) + ".");
    657664            this.die();
    658665            return;
    659666        }
    function repr(x) { 
    9971004    }
    9981005}
    9991006
     1007function safe_repr(s) {
     1008    return SAFE_LOGGING ? "[scrubbed]" : repr(s);
     1009}
     1010
    10001011/* Do we seem to be running in Tor Browser? Check the user-agent string and for
    10011012   no listing of supported MIME types. */
    10021013var TBB_UAS = [