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

[tor-commits] [atlas/master] Hash the fingerprints from summary documents



commit 40426f09f37ff84f93f20f156ab638ce27ff977a
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date:   Sat May 20 11:46:36 2017 +0000

    Hash the fingerprints from summary documents
    
    The summary documents are used for searches and form the basis for
    subsequent details document requests. The details documents requests
    use the lookup parameter which supports hashed and double hashed
    fingerprints to prevent users leaking bridge fingerprints.
    
    If a relay and a bridge share the same fingerprint FP (for example when
    a bridge becomes a relay without changing its fingerprint) the summary
    document for fingerprint FP contains both the relay fingerprint RP
    (where RP == FP) and the hashed bridge fingerprint BP (where BP ==
    H(FP)).
    
    The details document request for RP returns only the relay because RP ==
    FP and the details document request for BP returns the relay and the
    bridge because BP == H(FP) == H(RP). Relays take preference over bridges
    when both are returned and results in Atlas displaying the relay details
    twice on the search page.
    
    Hashing the fingerprints in the summary document results in details
    document requests for BP and H(BP) where BP returns the relay and bridge
    as before but where H(BP) returns only the bridge.
    
    Closes #21615.
---
 js/collections/results.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/js/collections/results.js b/js/collections/results.js
index c341321..54cd36a 100644
--- a/js/collections/results.js
+++ b/js/collections/results.js
@@ -3,8 +3,9 @@ define([
   'jquery',
   'underscore',
   'backbone',
-  'models/relay'
-], function($, _, Backbone, relayModel){
+  'models/relay',
+  'jssha'
+], function($, _, Backbone, relayModel, jsSHA){
 	var resultsCollection = Backbone.Collection.extend({
 		model: relayModel,
 		baseurl: 'https://onionoo.torproject.org/summary?search=',
@@ -24,12 +25,12 @@ define([
                 }
                 _.each(response.relays, function(relay, resultsC) {
                     crelay = new relayModel;
-                    crelay.fingerprint = relay.f;
+                    crelay.fingerprint = new jsSHA(relay.f, "HEX").getHash("SHA-1", "HEX").toUpperCase();
                     relays.push(crelay);
                 });
                 _.each(response.bridges, function(relay, resultsC) {
                     crelay = new relayModel;
-                    crelay.fingerprint = relay.h;
+                    crelay.fingerprint = new jsSHA(relay.h, "HEX").getHash("SHA-1", "HEX").toUpperCase();
                     relays.push(crelay);
                 });
                 if (relays.length == 0) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits