[tor-bugs] #8285 [Flashproxy]: facilitator-email-poller: don't process registrations that are too old

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Jun 1 04:13:40 UTC 2013


#8285: facilitator-email-poller: don't process registrations that are too old
-------------------------+--------------------------------------------------
 Reporter:  dcf          |          Owner:  dcf           
     Type:  enhancement  |         Status:  needs_revision
 Priority:  normal       |      Milestone:                
Component:  Flashproxy   |        Version:                
 Keywords:               |         Parent:                
   Points:               |   Actualpoints:                
-------------------------+--------------------------------------------------
Changes (by dcf):

  * status:  needs_review => needs_revision


Comment:

 Thanks for this patch.

 `REGISTRATION_LIMIT` should be `REGISTRATION_AGE_LIMIT` and should be in
 seconds, not minutes.
 {{{
 REGISTRATION_AGE_LIMIT = 30 * 60
 }}}

 Add another layer of abstraction, a function that takes a message and
 returns whether it should be acted on. The division of labor with
 `imap_loop` parsing out the header and `accept_message` reading it is
 weird. The changed code in `imap_loop` should be only:
 {{{
     if message_ok(msg):
         handle_message(msg)
 }}}

 There needs to be some error handling in case the X-Received header is
 missing or can't be parsed. What happens then? I at least need a special
 log message to happen in that case, so that I can eventually figure out
 what's wrong and fix it. I think my preference in this case is for it to
 fail open: if we can't tell how old the message is, treat it as new.

 This way of getting the date string is not robust:
 {{{
 header.splitlines()[-1]
 }}}
 There's no guarantee that the header will be split across lines in the
 same way always. I'm actually kind of surprised that the email code
 exposes those line breaks to you. Looking at
 http://cr.yp.to/immhf/envelope.html#received, it sounds like it's better
 to grab whatever follows the final semicolon. I'm assuming that X-received
 is the same as Received in that respect, which seems to be true from
 looking at my own inbox.

 I'd prefer not to use dateutil if possible. It looks like you can use
 [http://docs.python.org/2/library/email.util.html#email.utils.parsedate_tz
 email.utils.parsedate_tz] to parse the date out of the header, and
 [http://python.6.x6.nabble.com/issue14653-Improve-mktime-tz-to-use-
 calendar-timegm-instead-of-time-mktime-td4911509.html calendar.timegm] to
 turn that back into a UTC-based number. You can use `time.gmtime` and
 `calendar.timegm` to get a comparable value for the current time.

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


More information about the tor-bugs mailing list