[tor-bugs] #5810 [Stem]: Implement verification of server descriptor

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Nov 27 21:19:38 UTC 2012


#5810: Implement verification of server descriptor
-------------------------+--------------------------------------------------
 Reporter:  reganeet     |          Owner:  reganeet    
     Type:  enhancement  |         Status:  needs_review
 Priority:  normal       |      Milestone:              
Component:  Stem         |        Version:              
 Keywords:  descriptors  |         Parent:              
   Points:               |   Actualpoints:              
-------------------------+--------------------------------------------------
Changes (by eoinof):

  * status:  needs_revision => needs_review


Comment:

 Hey, we're getting there..
 Thanks for the code reviews..

 I only saw the hang problem when I was testing with invalid data.
 The existing data is fine. The problem seems to be related to how
 the threads handle an exception. The RelayDescriptor.__init__() raising an
 exception
 is new behaviour I guess..
 http://stackoverflow.com/questions/2829329/catch-a-threads-exception-in-
 the-caller-thread-in-python
 I think this can be addressed as a separate problem.

 My thinking with not storing the digest was that since
 many of the descriptors attributes are publicly accessible
 the code would behave better in the case where someone did this
 {{{
 a_desc = RelayDescriptor(desc)
 a_desc.contact = "hello"
 dig = a_desc.digest()
 }}}
 but I'm not sure that this is plausible usage.. also for this to work
 you'd need
 to use digest() everywhere in the code, and there would be no point in
 storing
 self._digest at all
 So I've switched to the caching approach.

 I've removed the logging calls, except the one that prints info on
 the fingerprint mismatch.
 I'm a big fan of logging but I'll defer to the norms of the project :)
 It's quite clear that warnings & errors are not that widely used as you
 don't
 see anything when running the unit tests with log level WARN/ERR.

 My thinking on leaving the digest as lowercase was that this is how it
 is stored in the signature. However I can change the code to convert it
 to lowercase & uppercase where necessary.

 I moved the key string splitting code to a separate function as it's done
 more than once.

 See this checkin.
 https://github.com/eoinof/stem/commit/d58abea3042a909464826e16e2b19bae10c29be4

 ps: some other "== None" occurences..

 stem/descriptor/server_descriptor.py~:    if self._scrubbing_issues ==
 None:
 stem/descriptor/server_descriptor.py:    if self._scrubbing_issues ==
 None:
 stem/connection.py:    if controller == None:

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/5810#comment:26>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list