[tor-bugs] #26316 [Core Tor/Tor]: Windows newlines in extrainfo descriptor

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Oct 15 03:10:29 UTC 2018


#26316: Windows newlines in extrainfo descriptor
--------------------------------------------+------------------------------
 Reporter:  atagar                          |          Owner:  (none)
     Type:  defect                          |         Status:  new
 Priority:  Medium                          |      Milestone:  Tor:
                                            |  unspecified
Component:  Core Tor/Tor                    |        Version:
 Severity:  Normal                          |     Resolution:
 Keywords:  035-roadmap-proposed, tor-spec  |  Actual Points:
Parent ID:                                  |         Points:
 Reviewer:                                  |        Sponsor:
--------------------------------------------+------------------------------
Changes (by teor):

 * keywords:  035-roadmap-proposed => 035-roadmap-proposed, tor-spec


Comment:

 Replying to [comment:2 atagar]:
 > Hi Nick. I disagree that these are valid according to the spec. If they
 were I'd adjust things on Stem's side. For example, here's the spec for
 dirreq-stats-end lines. It does not specify allowing a CR before the NL.
 >
 > https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt#n919

 But the metadocument format allows lines containing CR:

 {{{
     NL = The ascii LF character (hex value 0x0a).
     Document ::= (Item | NL)+
     Item ::= KeywordLine Object*
     KeywordLine ::= Keyword NL | Keyword WS ArgumentChar+ NL
     Keyword = KeywordChar+
     KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-'
     ArgumentChar ::= any printing ASCII character except NL.
     WS = (SP | TAB)+
 }}}

 And requires implementations to accept extra arguments:

 {{{
    For forward compatibility, each item MUST allow extra arguments at the
    end of the line unless otherwise noted.  So if an item's description
 below
    is given as:
        "thing" int int int NL
    then implementations SHOULD accept this string as well:
        "thing 5 9 11 13 16 12" NL
    but not this string:
        "thing 5" NL
    and not this string:
        "thing 5 10 thing" NL
    .

    Whenever an item DOES NOT allow extra arguments, we will tag it with
    "no extra arguments".
 }}}

 If the line was:
 {{{
 dirreq-stats-end 2018-06-05 06:11:40 (86400 s) ^M
 }}}

 Then the trailing CR would be an "extra argument".

 But since there is no WS between the final argument and the CR:

 {{{
 dirreq-stats-end 2018-06-05 06:11:40 (86400 s)^M
 }}}

 The final argument is malformed.

 Let's resolve this issue by patching torspec to match the current
 behaviour of tor and metrics.

 We could:
 * allow a trailing CR on each line
 * make CR part of WS
 * (something else?)

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


More information about the tor-bugs mailing list