[tor-commits] [tor/release-0.4.5] Reject obsolete router/extrainfo descs more quietly.

asn at torproject.org asn at torproject.org
Thu Jan 21 22:24:04 UTC 2021


commit ca6ccd372f8f56c842dfad8203bace99be580b90
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jan 11 14:50:40 2021 -0500

    Reject obsolete router/extrainfo descs more quietly.
    
    Thanks to proposal 315 / ticket #30132, more fields are now
    required in these documents.  But ancient Tors that try to upload
    obsolete documents were causing the authorities to log warnings
    about missing fields, and to do so very spammily.
    
    We now detect the missing fields before tokenizing, and log at
    debug.  This is a bit of ugliness, but it's probably a safer choice
    than making _all_ unparseable-desc warnings into debug-level logs.
    
    I'm looking at identity-ed25519 in extrainfos and proto in
    routerdescs because they were (I believe) the latest-added fields in
    Tor's history: any Tor that lacks them will also lack the other
    newly required fields.
    
    Fixes bug #40238; bugfix on 0.4.5.1-alpha.
---
 src/feature/dirparse/routerparse.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/feature/dirparse/routerparse.c b/src/feature/dirparse/routerparse.c
index 635fc4b49d..3d90c1bc91 100644
--- a/src/feature/dirparse/routerparse.c
+++ b/src/feature/dirparse/routerparse.c
@@ -456,6 +456,12 @@ router_parse_entry_from_string(const char *s, const char *end,
     }
   }
 
+  if (!tor_memstr(s, end-s, "\nproto ")) {
+    log_debug(LD_DIR, "Found an obsolete router descriptor. "
+              "Rejecting quietly.");
+    goto err;
+  }
+
   if (router_get_router_hash(s, end - s, digest) < 0) {
     log_warn(LD_DIR, "Couldn't compute router hash.");
     goto err;
@@ -991,6 +997,11 @@ extrainfo_parse_entry_from_string(const char *s, const char *end,
   while (end > s+2 && *(end-1) == '\n' && *(end-2) == '\n')
     --end;
 
+  if (!tor_memstr(s, end-s, "\nidentity-ed25519")) {
+    log_debug(LD_DIR, "Found an obsolete extrainfo. Rejecting quietly.");
+    goto err;
+  }
+
   if (router_get_extrainfo_hash(s, end-s, digest) < 0) {
     log_warn(LD_DIR, "Couldn't compute router hash.");
     goto err;





More information about the tor-commits mailing list