#25188: Spec bug in formal definition of Document in dir-spec.txt ------------------------------+---------------------- Reporter: witchof0x20 | Owner: (none) Type: enhancement | Status: new Priority: Very Low | Milestone: Component: Core Tor/Tor | Version: Severity: Trivial | Keywords: tor-spec Actual Points: | Parent ID: Points: | Reviewer: Sponsor: | ------------------------------+---------------------- I was attempting to write a parser that reads vote/consensus documents using the the formal definition [https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt#n210 here]. However, I noticed an ambiguity.
Using only the formal definition, the following: {{{ directory-signature 13241234321 12343234 -----BEGIN SIGNATURE----- 00thisisvalidbase64data12345 -----END SIGNATURE----- }}} Could be potentially parsed as {{{ Document( Item( KeywordLine( Keyword(KeywordChar+("directory-signature")), WS, ArgumentChar+("13241234321 12343234"), NL ) ), Item( KeywordLine( Keyword(KeywordChar+("-----BEGIN")), WS, ArgumentChar+("SIGNATURE-----"), NL ) ), Item( KeywordLine( Keyword(KeywordChar+("00thisisvalidbase64data12345")) WS, ArgumentChar+("SIGNATURE-----"), NL ) ), Item( KeywordLine( Keyword(KeywordChar+("-----END")), WS, ArgumentChar+("SIGNATURE-----"), NL ) ), ) }}} When the correct parsing would be {{{ Document( Item( KeywordLine( Keyword(KeywordChar+("directory-signature")), WS, ArgumentChar+("13241234321 12343234"), NL ), Object( BeginLine( "-----BEGIN ", Keyword(KeywordChar+("SIGNATURE")), "-----", NL ), Base64-encoded-data("00thisisvalidbase64data12345"), EndLine( "-----END ", Keyword(KeywordChar+("SIGNATURE")), "-----", NL ), ), ), ) }}} A potential change to the spec (assuming that keywords will never start with "-") that would prevent would be to replace {{{ Keyword = KeywordChar+ KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-' }}} with {{{ Keyword = KeywordStartChar KeywordChar* KeywordStartChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-' }}} -- Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25188> Tor Bug Tracker & Wiki <https://trac.torproject.org/> The Tor Project: anonymity online
_______________________________________________ tor-bugs mailing list tor-bugs@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs