[tor-bugs] #11257 [Stem]: Stem believes that all bridge-extrainfo-descriptors have a 'router-digest' field
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Mar 21 01:05:11 UTC 2014
#11257: Stem believes that all bridge-extrainfo-descriptors have a 'router-digest'
field
------------------------+------------------------------
Reporter: isis | Owner: atagar
Type: defect | Status: new
Priority: normal | Milestone:
Component: Stem | Version:
Resolution: | Keywords: bridgedb-parsers
Actual Points: | Parent ID:
Points: |
------------------------+------------------------------
Description changed by isis:
Old description:
> When parsing the following mock descriptor, which looks identical to a
> current real `@type bridge-extrainfo` descriptor, I get the following
> exception:
>
> {{{
> In [1]: import stem
>
> In [2]: stem.__version__
> Out[2]: '1.1.1'
>
> In [3]: from stem.descriptor import extrainfo_descriptor
>
> In [4]: raweidesc = """
> extra-info LoneRevulsion E72E3DC5FAD5550DBCCB4429BBF0A7BB2FAD72E2
> published 2014-03-12 20:56:50
> write-history 2014-03-12 20:56:50 (900 s) 3188736,2226176,2866176
> read-history 2014-03-12 20:56:50 (900 s) 3891200,2483200,2698240
> dirreq-write-history 2014-03-12 20:56:50 (900 s) 1024,0,2048
> dirreq-read-history 2014-03-12 20:56:50 (900 s) 0,0,0
> geoip-db-digest D7D3AB5AF68AAC8F316BF9DEE7B7D0B0BC1238D7
> geoip6-db-digest 76634AB48969832AA37F78F252726AB9803ECFB8
> dirreq-stats-end 2014-03-12 20:56:50 (86400 s)
> dirreq-v3-ips
> dirreq-v3-reqs
> dirreq-v3-resp ok=16,not-enough-sigs=0,unavailable=0,not-found=0,not-
> modified=0,busy=0
> dirreq-v3-direct-dl complete=0,timeout=0,running=0
> dirreq-v3-tunneled-dl complete=12,timeout=0,running=0
> transport obfs3 254.99.16.232:31196
> transport obfs2 254.99.16.232:31197
> bridge-stats-end 2014-03-12 20:56:50 (86400 s)
> bridge-ips ca=8
> bridge-ip-versions v4=8,v6=0
> bridge-ip-transports <OR>=8
> router-signature
> -----BEGIN SIGNATURE-----
> duS1H+K32B3uKYA2sKcl+cKXL8PXKfJAQ+gnmsQ949qM85/8fWeX1j9xyUAlpN8q
> 5lUm0gSoNRLraTTtVg6jYA9BTlfcMlYz6hoyKjQRbFeT8OiU0Z3alQFCZl/qlVii
> 0juw8yjc6p4gNprm7gfP+h2VImm27kC/ZMNvloB5bEs=
> -----END SIGNATURE-----
> """
>
> In [5]: extrainfo_descriptor.BridgeExtraInfoDescriptor(raweidesc)
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call
> last)
> <ipython-input-3-0ed04607c709> in <module>()
> ----> 1 extrainfo_descriptor.BridgeExtraInfoDescriptor(raweidesc)
>
> /home/isis/.virtualenvs/bridgedb/lib/python2.7/site-
> packages/stem/descriptor/extrainfo_descriptor.pyc in __init__(self,
> raw_contents, validate)
> 904 self._digest = None
> 905
> --> 906 super(BridgeExtraInfoDescriptor, self).__init__(raw_contents,
> validate)
> 907
> 908 def digest(self):
>
> /home/isis/.virtualenvs/bridgedb/lib/python2.7/site-
> packages/stem/descriptor/extrainfo_descriptor.pyc in __init__(self,
> raw_contents, validate)
> 423 for keyword in self._required_fields():
> 424 if not keyword in entries:
> --> 425 raise ValueError("Extra-info descriptor must have a
> '%s' entry" % keyword)
> 426
> 427 for keyword in self._required_fields() + SINGLE_FIELDS:
>
> ValueError: Extra-info descriptor must have a 'router-digest' entry
> }}}
>
> Atagar says this was done
> [https://gitweb.torproject.org/stem.git/commitdiff/e7e03d2f61d6dcc7bc5e5ad4dee91c37a814ee16
> in this commit], because the sanitised bridge descriptors on the metrics
> server are supposed to have the 'router-digest' field, which is a SHA-1
> of the corresponding `@type bridge-server-descriptor`.
>
> BridgeDB needs an extrainfo parser which works with ''unsanitised''
> descriptors (see #9380, #10725, and #11216). We probably need to create
> an `UnsanitisedBridgeExtraInfoDescriptor` class in Stem, if atagar is
> will to take such a patch. :) If not, I can keep the `Unsanitised`
> classes in BridgeDB, since presently that is the only component which
> would actually be using these classes. (I can also maintain them, if they
> end up in Stem, since I'll likely be one of the only people to notice if
> something breaks/changes.)
New description:
When parsing the following mock descriptor, which looks identical to a
current real `@type bridge-extrainfo` descriptor, I get the following
exception:
{{{
In [1]: import stem
In [2]: stem.__version__
Out[2]: '1.1.1'
In [3]: from stem.descriptor import extrainfo_descriptor
In [4]: raweidesc = """
extra-info LoneRevulsion E72E3DC5FAD5550DBCCB4429BBF0A7BB2FAD72E2
published 2014-03-12 20:56:50
write-history 2014-03-12 20:56:50 (900 s) 3188736,2226176,2866176
read-history 2014-03-12 20:56:50 (900 s) 3891200,2483200,2698240
dirreq-write-history 2014-03-12 20:56:50 (900 s) 1024,0,2048
dirreq-read-history 2014-03-12 20:56:50 (900 s) 0,0,0
geoip-db-digest D7D3AB5AF68AAC8F316BF9DEE7B7D0B0BC1238D7
geoip6-db-digest 76634AB48969832AA37F78F252726AB9803ECFB8
dirreq-stats-end 2014-03-12 20:56:50 (86400 s)
dirreq-v3-ips
dirreq-v3-reqs
dirreq-v3-resp ok=16,not-enough-sigs=0,unavailable=0,not-found=0,not-
modified=0,busy=0
dirreq-v3-direct-dl complete=0,timeout=0,running=0
dirreq-v3-tunneled-dl complete=12,timeout=0,running=0
transport obfs3 254.99.16.232:31196
transport obfs2 254.99.16.232:31197
bridge-stats-end 2014-03-12 20:56:50 (86400 s)
bridge-ips ca=8
bridge-ip-versions v4=8,v6=0
bridge-ip-transports <OR>=8
router-signature
-----BEGIN SIGNATURE-----
duS1H+K32B3uKYA2sKcl+cKXL8PXKfJAQ+gnmsQ949qM85/8fWeX1j9xyUAlpN8q
5lUm0gSoNRLraTTtVg6jYA9BTlfcMlYz6hoyKjQRbFeT8OiU0Z3alQFCZl/qlVii
0juw8yjc6p4gNprm7gfP+h2VImm27kC/ZMNvloB5bEs=
-----END SIGNATURE-----
"""
In [5]: extrainfo_descriptor.BridgeExtraInfoDescriptor(raweidesc)
---------------------------------------------------------------------------
ValueError Traceback (most recent call
last)
<ipython-input-3-0ed04607c709> in <module>()
----> 1 extrainfo_descriptor.BridgeExtraInfoDescriptor(raweidesc)
/home/isis/.virtualenvs/bridgedb/lib/python2.7/site-
packages/stem/descriptor/extrainfo_descriptor.pyc in __init__(self,
raw_contents, validate)
904 self._digest = None
905
--> 906 super(BridgeExtraInfoDescriptor, self).__init__(raw_contents,
validate)
907
908 def digest(self):
/home/isis/.virtualenvs/bridgedb/lib/python2.7/site-
packages/stem/descriptor/extrainfo_descriptor.pyc in __init__(self,
raw_contents, validate)
423 for keyword in self._required_fields():
424 if not keyword in entries:
--> 425 raise ValueError("Extra-info descriptor must have a '%s'
entry" % keyword)
426
427 for keyword in self._required_fields() + SINGLE_FIELDS:
ValueError: Extra-info descriptor must have a 'router-digest' entry
}}}
Atagar says this was done
[https://gitweb.torproject.org/stem.git/commitdiff/e7e03d2f61d6dcc7bc5e5ad4dee91c37a814ee16
in this commit], because the sanitised bridge descriptors on the metrics
server are supposed to have the 'router-digest' field, which is a SHA-1 of
the corresponding `@type bridge-server-descriptor`.
BridgeDB needs an extrainfo parser which works with ''unsanitised''
descriptors (see #9380, #10725, and #11216). We probably need to create an
`UnsanitisedBridgeExtraInfoDescriptor` class in Stem, if atagar is willing
to take such a patch. :) If not, I can keep the `Unsanitised` classes in
BridgeDB, since presently that is the only component which would actually
be using these classes. (I can also maintain them, if they end up in Stem,
since I'll likely be one of the only people to notice if something
breaks/changes.)
--
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11257#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list